From ef9ab1fd141f4057d41f2d6ed8ab8d67c44894d5 Mon Sep 17 00:00:00 2001 From: Preston Pan Date: Thu, 9 Jan 2025 16:32:55 -0800 Subject: save state --- src/common/array.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/common/array.c') diff --git a/src/common/array.c b/src/common/array.c index 4ebb67e..9648f5a 100644 --- a/src/common/array.c +++ b/src/common/array.c @@ -39,9 +39,10 @@ array_t *array_reverse(array_t *a) { void array_free(void *x, void (*freefunc)(void *)) { array_t *a = (array_t *)x; - for (int i = 0; i < a->size; i++) { + if (!x) + return; + for (int i = 0; i < a->size; i++) freefunc(a->items[i]); - } free(a->items); free(a); } -- cgit