From 221b05e7a86faa38036429d5fbfc8b0779eb5382 Mon Sep 17 00:00:00 2001 From: Matthew Sotoudeh Date: Fri, 17 May 2024 15:39:56 -0700 Subject: fix bug --- magic_buddy/magic_buddy.c | 1 + 1 file changed, 1 insertion(+) (limited to 'magic_buddy') diff --git a/magic_buddy/magic_buddy.c b/magic_buddy/magic_buddy.c index 1029f58..15bd23f 100644 --- a/magic_buddy/magic_buddy.c +++ b/magic_buddy/magic_buddy.c @@ -87,6 +87,7 @@ static void *_allocate(size_t logsize, struct buddy *state) { if (logsize == state->root_logsize) return 0; struct free_block *parent = _allocate(logsize + 1, state); + if (!parent) return 0; struct free_block *buddy = buddy_of(parent, logsize, state); // split @parent in half and place the buddy on the avail list. memcpy(buddy->magic, state->magic, sizeof(state->magic)); -- cgit v1.2.3