diff options
-rw-r--r-- | source3/lib/util_array.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/source3/lib/util_array.c b/source3/lib/util_array.c index dcb08d9ce7..8ad8da61c3 100644 --- a/source3/lib/util_array.c +++ b/source3/lib/util_array.c @@ -61,18 +61,17 @@ void* add_item_to_array(uint32 *len, void ***array, void *item) void **tary; if (len == NULL || array == NULL) - { return NULL; - } tary = (void**)Realloc((*array), ((*len)+1)*sizeof((*array)[0])); - if (tary != NULL) - { + if (tary != NULL) { (*array) = tary; (*array)[(*len)] = item; (*len)++; return item; + } else { + free((char *)*array); } return NULL; } |