]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
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 75efb85bf660fa5ab8573dd24d0be976364d9281..8d619116a7826d5a7c132998bc0c6faeafe6cab7 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;
 }