After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 747364 - Fix GError leak in g_file_query_writable_namespaces()
Fix GError leak in g_file_query_writable_namespaces()
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gio
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2015-04-05 09:43 UTC by Christophe Fergeau
Modified: 2015-08-21 04:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix GError leak in g_file_query_writable_namespaces() (1.63 KB, patch)
2015-04-05 09:43 UTC, Christophe Fergeau
committed Details | Review

Description Christophe Fergeau 2015-04-05 09:43:35 UTC
gvfs commit b358ca "Make sure metadata is always returned by
query_writable_namespaces()" changed the
query_writable_namespaces vfunc to never return NULL, but the error
checking in g_daemon_file_query_writable_namespaces still assumes vfunc
failure implies NULL return value and GError set. This causes a memory
leak as on failure the GError will be set but the vfunc implementation
will have created its own default list so NULL will not be returned, and
the GError will never be cleared.

This commit directly checks if the GError is set to detect failures,
my_error is directly dereferenced in the error block anyway.

This also removes an unneeded call to g_file_attribute_info_new(); as
the vfunc always returns us a non-NULL GFileAttributeInfoList.
Comment 1 Christophe Fergeau 2015-04-05 09:43:40 UTC
Created attachment 300980 [details] [review]
Fix GError leak in g_file_query_writable_namespaces()
Comment 2 Matthias Clasen 2015-08-21 04:45:14 UTC
Attachment 300980 [details] pushed as 60a6ae6 - Fix GError leak in g_file_query_writable_namespaces()