mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-05-01 19:46:53 +02:00
gfileenumerator: Don't leak memory if out_info is NULL
In the unusual case where one just wants the filenames, avoid a leak. https://bugzilla.gnome.org/show_bug.cgi?id=754211
This commit is contained in:
parent
4cbd0d6a60
commit
f8341badb8
@ -657,11 +657,6 @@ g_file_enumerator_iterate (GFileEnumerator *direnum,
|
|||||||
|
|
||||||
if (ret_info)
|
if (ret_info)
|
||||||
{
|
{
|
||||||
if (out_info != NULL)
|
|
||||||
{
|
|
||||||
g_object_set_qdata_full ((GObject*)direnum, cached_info_quark, ret_info, (GDestroyNotify)g_object_unref);
|
|
||||||
*out_info = ret_info;
|
|
||||||
}
|
|
||||||
if (out_child != NULL)
|
if (out_child != NULL)
|
||||||
{
|
{
|
||||||
const char *name = g_file_info_get_name (ret_info);
|
const char *name = g_file_info_get_name (ret_info);
|
||||||
@ -674,6 +669,13 @@ g_file_enumerator_iterate (GFileEnumerator *direnum,
|
|||||||
g_object_set_qdata_full ((GObject*)direnum, cached_child_quark, *out_child, (GDestroyNotify)g_object_unref);
|
g_object_set_qdata_full ((GObject*)direnum, cached_child_quark, *out_child, (GDestroyNotify)g_object_unref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (out_info != NULL)
|
||||||
|
{
|
||||||
|
g_object_set_qdata_full ((GObject*)direnum, cached_info_quark, ret_info, (GDestroyNotify)g_object_unref);
|
||||||
|
*out_info = ret_info;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
g_object_unref (ret_info);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user