From e164cdb793b4d400999435d6f8308d9fb9285f37 Mon Sep 17 00:00:00 2001 From: Theldus Date: Fri, 24 Apr 2020 22:03:10 -0300 Subject: [PATCH] Bug Fix: Freeing Array Structure If Out of Memory --- src/array.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/array.c b/src/array.c index 64fdb5c..16c2592 100644 --- a/src/array.c +++ b/src/array.c @@ -44,7 +44,10 @@ int array_init(struct array **array) out->elements = 0; out->buf = calloc(out->capacity, sizeof(void *)); if (out->buf == NULL) + { + free(out); return (-1); + } *array = out; return (0);