From 11521b99661f969ba7adad9d2366108a1a001ab0 Mon Sep 17 00:00:00 2001 From: "Douglas B. Rumbaugh" Date: Sun, 2 Nov 2025 18:29:20 -0500 Subject: Defined allocator behavior for 0 byte requests --- tests/liballoc_tests.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests') diff --git a/tests/liballoc_tests.c b/tests/liballoc_tests.c index 16d50d6..a54998a 100644 --- a/tests/liballoc_tests.c +++ b/tests/liballoc_tests.c @@ -26,6 +26,10 @@ START_TEST(basic_allocate) { size_t alignment = (size_t)memory % ALIGNMENT; ck_assert_int_eq(alignment, 0); + /* allocating 0 size should return NULL */ + void *memory2 = allocate(0); + ck_assert_ptr_eq(memory2, NULL); + /* leak the memory--we aren't testing release */ } END_TEST -- cgit v1.2.3