diff options
author | Preston Pan <ret2pop@gmail.com> | 2025-01-09 16:32:55 -0800 |
---|---|---|
committer | Preston Pan <ret2pop@gmail.com> | 2025-01-09 16:32:55 -0800 |
commit | ef9ab1fd141f4057d41f2d6ed8ab8d67c44894d5 (patch) | |
tree | e4005b7a641303b021eb54c2aae5676b5f92a72d /src/common/array.c | |
parent | 1fd608288ee47c2c560817f12f14b21069fed2f6 (diff) |
Diffstat (limited to 'src/common/array.c')
-rw-r--r-- | src/common/array.c | 5 |
1 files changed, 3 insertions, 2 deletions
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); } |