string_list_free - try to be safer
This commit is contained in:
parent
9c12037c43
commit
15e7078361
|
@ -41,15 +41,18 @@ void string_list_free(struct string_list *list)
|
||||||
if (!list)
|
if (!list)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < list->size; i++)
|
if (list->elems)
|
||||||
{
|
{
|
||||||
if (list->elems[i].data)
|
for (i = 0; i < list->size; i++)
|
||||||
free(list->elems[i].data);
|
{
|
||||||
list->elems[i].data = NULL;
|
if (list->elems[i].data)
|
||||||
|
free(list->elems[i].data);
|
||||||
|
list->elems[i].data = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
free(list->elems);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (list->elems)
|
|
||||||
free(list->elems);
|
|
||||||
list->elems = NULL;
|
list->elems = NULL;
|
||||||
free(list);
|
free(list);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue