slirp: Fix g_array_free to correctly handle freeing an unallocateed GArray. Fix #243

This commit is contained in:
Mark Pizzolato 2015-10-26 06:03:12 -07:00
parent 7ad57d7fa8
commit 480c71dea5

View file

@ -300,11 +300,13 @@ gchar *
g_array_free (GArray *array,
gboolean free_segment)
{
gchar *result = free_segment ? NULL : array->data;
gchar *result = ((array == NULL) || free_segment) ? NULL : array->data;
if (free_segment)
free (array->data);
free (array);
if (array != NULL) {
if (free_segment)
free (array->data);
free (array);
}
return result;
}