From a66d9582a16eb3c15bf727db84431660ae20b2f2 Mon Sep 17 00:00:00 2001 From: "Douglas B. Rumbaugh" Date: Sun, 2 Nov 2025 15:41:54 -0500 Subject: alloc.c: releasing NULL now works My initial free list implementation revealed a bug that I wasn't handling release(NULL) correctly, resulting in a segfault. After this commit, all existing tests pass for liballoc. --- src/alloc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/alloc.c b/src/alloc.c index 830e49f..2f4aa03 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -76,6 +76,10 @@ void *allocate(size_t size) { } void release(void *ptr) { + if (!ptr) { + return; + } + fl_add_node(&free_list, ptr); fl_coalesce_nodes(free_list); } -- cgit v1.2.3