array: Allocate initial data properly if esize is 0
authorTobias Brunner <tobias@strongswan.org>
Mon, 29 Jul 2013 16:05:33 +0000 (18:05 +0200)
committerTobias Brunner <tobias@strongswan.org>
Thu, 15 May 2014 09:28:05 +0000 (11:28 +0200)
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;
 }