Fix arena_delete()
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define KNOB_MMAP_SIZE (1UL << 40UL)
|
#define KNOB_MMAP_SIZE (1UL << 36UL)
|
||||||
#define KNOB_ALIGNMENT (sizeof(char*))
|
#define KNOB_ALIGNMENT (sizeof(char*))
|
||||||
|
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ int arena_delete(struct arena *a)
|
|||||||
if (!(a->flags & ARENA_GROW)) {
|
if (!(a->flags & ARENA_GROW)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
int ok = munmap(a->data, a->cap);
|
int ok = munmap(a->data, KNOB_MMAP_SIZE);
|
||||||
if (ok == -1) {
|
if (ok == -1) {
|
||||||
arena_err("munmap");
|
arena_err("munmap");
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -98,6 +98,8 @@ int main()
|
|||||||
fprintf(stderr, "arena_delete was supposed to fail, but didn't\n");
|
fprintf(stderr, "arena_delete was supposed to fail, but didn't\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(arena_detatch(a));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user