diff options
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 11 |
1 files changed, 1 insertions, 10 deletions
@@ -12,21 +12,12 @@ void get_random(uint8_t *dst, size_t count) { close(fd); } -// helper for getting an aligned allocation -static void *malloc_aligned(size_t size) { - uint8_t *data = malloc(size); - if (!((size_t)data % size)) return data; - data = realloc(data, size * 2); - data = data + (size - ((size_t)data % size)); - return data; -} - void main() { size_t region_size = 1024 * 1024; uint8_t magic[MAGIC_COOKIE_BYTES]; get_random(magic, MAGIC_COOKIE_BYTES); - init_buddy(malloc_aligned(region_size), region_size, magic); + init_buddy(malloc(region_size), region_size, magic); memset(magic, 0, sizeof(magic)); void *x = allocate(1024); |