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 --- src/alloc.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/alloc.c') diff --git a/src/alloc.c b/src/alloc.c index 39cbf88..32eb18a 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -44,6 +44,11 @@ void *allocate(size_t size) { initialize(); } + /* special case for a size 0 allocation */ + if (size == 0) { + return NULL; + } + /* * pad the requested size to ensure alignment using * the alignment one-liner we discussed in class -- cgit v1.2.3