fix: write correctly prev and next block on deletion

This commit is contained in:
2024-07-30 11:33:42 +02:00
parent 290a120319
commit 98a5e989c2
2 changed files with 25 additions and 10 deletions

View File

@ -33,6 +33,7 @@ int main(int ac, char **av)
test(NULL, allocs_tree[LARGE], "alloc free", "simple alloc, simple free");
ptr = ft_malloc(10000000);
test(ptr, ((void **) allocs_tree[LARGE])[CHUNK_DATA_START_POS], "free alloc", "alloc after a free on the first block");
ft_free(ptr);
void *ptr1 = ft_malloc(10000000);
void *ptr2 = ft_malloc(10000000);
void *ptr3 = ft_malloc(10000000);
@ -42,9 +43,9 @@ int main(int ac, char **av)
ft_free(ptr1);
test(NOT_NULL, raw_get_chunk(allocs_tree[LARGE], ptr2), "free disorder1", "");
ft_free(ptr3);
test(NOT_NULL, raw_get_chunk(allocs_tree[LARGE], ptr2), "free disorder1", "");
test(NOT_NULL, raw_get_chunk(allocs_tree[LARGE], ptr2), "free disorder2", "");
ft_free(ptr2);
test(NULL, allocs_tree[LARGE], "free disorder1", "");
test(NULL, allocs_tree[LARGE], "free disorder3", "");
return 0;
}