[Spice-devel] [spice-gtk] Fix GSocketAddress leak in proxy_lookup_ready()

Christophe Fergeau cfergeau at redhat.com
Thu Apr 16 06:36:35 PDT 2015


g_proxy_address_new() returns a new GProxyAddress, so we must unref it
when no longer needed.

This fixes:

==6481== 234 (48 direct, 186 indirect) bytes in 1 blocks are definitely lost in loss record 10,062 of 10,
==6481==    at 0x31FF230A58: g_type_create_instance (gtype.c:1849)
==6481==    by 0x31FF21501A: g_object_new_internal (gobject.c:1774)
==6481==    by 0x31FF216EB4: g_object_new_valist (gobject.c:2033)
==6481==    by 0x31FF217220: g_object_new (gobject.c:1617)
==6481==    by 0x3D4386F33A: g_proxy_address_new (gproxyaddress.c:325)
==6481==    by 0x5717440: proxy_lookup_ready (spice-session.c:2011)
==6481==    by 0x3D43885082: g_task_return_now (gtask.c:1088)
==6481==    by 0x3D438850B8: complete_in_idle_cb (gtask.c:1102)
==6481==    by 0x31FEE4A0B9: g_main_dispatch (gmain.c:3122)
==6481==    by 0x31FEE4A0B9: g_main_context_dispatch (gmain.c:3737)
==6481==    by 0x31FEE4A44F: g_main_context_iterate.isra.29 (gmain.c:3808)
==6481==    by 0x31FEE4A771: g_main_loop_run (gmain.c:4002)
==6481==    by 0x363AC06CC4: gtk_main (in /usr/lib64/libgtk-3.so.0.1600.1)
---
 gtk/spice-session.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gtk/spice-session.c b/gtk/spice-session.c
index 1a68d7d..020a70e 100644
--- a/gtk/spice-session.c
+++ b/gtk/spice-session.c
@@ -2020,6 +2020,7 @@ static void proxy_lookup_ready(GObject *source_object, GAsyncResult *result,
 
     open_host_connectable_connect(open_host, G_SOCKET_CONNECTABLE(address));
     g_resolver_free_addresses(addresses);
+    g_object_unref(address);
 }
 
 /* main context */
-- 
2.3.5



More information about the Spice-devel mailing list