aboutsummaryrefslogtreecommitdiff
path: root/src/common/array.c
diff options
context:
space:
mode:
authorPreston Pan <ret2pop@gmail.com>2025-01-09 16:32:55 -0800
committerPreston Pan <ret2pop@gmail.com>2025-01-09 16:32:55 -0800
commitef9ab1fd141f4057d41f2d6ed8ab8d67c44894d5 (patch)
treee4005b7a641303b021eb54c2aae5676b5f92a72d /src/common/array.c
parent1fd608288ee47c2c560817f12f14b21069fed2f6 (diff)
save stateHEADmain
Diffstat (limited to 'src/common/array.c')
-rw-r--r--src/common/array.c5
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);
}