aboutsummaryrefslogtreecommitdiff
path: root/src/common/array.c
diff options
context:
space:
mode:
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);
}