(string_list.c) Initialize data after realloc()ing the list

This commit is contained in:
Higor Eurípedes 2015-07-05 20:13:26 -03:00
parent 044ef3d3f4
commit 8c9c1df64b

View File

@ -66,6 +66,9 @@ static bool string_list_capacity(struct string_list *list, size_t cap)
if (!new_data)
return false;
if (cap > list->cap)
memset(&new_data[list->cap], 0, sizeof(*new_data) * (cap - list->cap));
list->elems = new_data;
list->cap = cap;
return true;