array: Allocate initial data properly if esize is 0
[strongswan.git] / src / libstrongswan / collections / array.c
index 75efb85..8d61911 100644 (file)
@@ -168,7 +168,7 @@ array_t *array_create(u_int esize, u_int8_t reserve)
        );
        if (array->tail)
        {
-               array->data = malloc(array->tail * array->esize);
+               array->data = malloc(get_size(array, array->tail));
        }
        return array;
 }