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 587415 - g_resolver_lookup_by_name_finish returns a freed list
g_resolver_lookup_by_name_finish returns a freed list
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gio
2.21.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2009-06-30 10:48 UTC by Guillaume Desmottes
Modified: 2009-06-30 22:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed fix in this branch: http://git.collabora.co.uk/?p=user/cassidy/glib;a=shortlog;h=refs/heads/resolver-fix (611 bytes, patch)
2009-06-30 10:50 UTC, Guillaume Desmottes
none Details | Review
Fix GResolver for g_simple_async_result_set_op_res_gpointer change (1.84 KB, patch)
2009-06-30 15:28 UTC, Dan Winship
committed Details | Review

Description Guillaume Desmottes 2009-06-30 10:48:58 UTC
When unsetting the res_gpointer in g_resolver_lookup_by_name_finish , the associated DestroyNotify function is called (g_resolver_free_addresses) and so it returns a freed list.

According to the doc, user is supposed to free the list himself.
Comment 1 Guillaume Desmottes 2009-06-30 10:50:53 UTC
Created attachment 137611 [details] [review]
proposed fix in this branch: http://git.collabora.co.uk/?p=user/cassidy/glib;a=shortlog;h=refs/heads/resolver-fix

 gio/gresolver.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Comment 2 Dan Winship 2009-06-30 15:28:26 UTC
Created attachment 137630 [details] [review]
Fix GResolver for g_simple_async_result_set_op_res_gpointer change

That patch will leak the data if the caller just unrefs the result rather
than calling the finish function (which is allowed). This should fix both
cases.
Comment 3 Guillaume Desmottes 2009-06-30 15:49:20 UTC
Indeed; your fix is better.
Comment 4 Dan Winship 2009-06-30 22:49:18 UTC
committed