mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-21 16:38:54 +02:00
Fix memory leak and dubious list manipulation. (Found by Ron Koerner,
Thu Jul 19 16:05:21 2001 Owen Taylor <otaylor@redhat.com> * glib/gcompletion.c (g_completion_complete): Fix memory leak and dubious list manipulation. (Found by Ron Koerner, #53408) * glib/gfileutils.c (get_contents_stdio): Call fclose() on FILE * on error. (#57057)
This commit is contained in:
@@ -182,16 +182,14 @@ g_completion_complete (GCompletion* cmp,
|
|||||||
list = cmp->cache;
|
list = cmp->cache;
|
||||||
while (list)
|
while (list)
|
||||||
{
|
{
|
||||||
|
GList *next = list->next;
|
||||||
|
|
||||||
if (cmp->strncmp_func (prefix,
|
if (cmp->strncmp_func (prefix,
|
||||||
cmp->func ? cmp->func (list->data) : (gchar*) list->data,
|
cmp->func ? cmp->func (list->data) : (gchar*) list->data,
|
||||||
len))
|
len))
|
||||||
{
|
cmp->cache = g_list_delete_link (cmp->cache, list);
|
||||||
list = g_list_remove_link (cmp->cache, list);
|
|
||||||
if (list != cmp->cache)
|
list = next;
|
||||||
cmp->cache = list;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
list = list->next;
|
|
||||||
}
|
}
|
||||||
done = TRUE;
|
done = TRUE;
|
||||||
}
|
}
|
||||||
|
@@ -309,6 +309,7 @@ get_contents_stdio (const gchar *filename,
|
|||||||
filename, strerror (errno));
|
filename, strerror (errno));
|
||||||
|
|
||||||
g_string_free (str, TRUE);
|
g_string_free (str, TRUE);
|
||||||
|
fclose (f);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user