Commit ae048625 authored by Hans Petter Jansson's avatar Hans Petter Jansson

GDbusProxy: Plug memory leak.

proxy->priv->name_owner gets overwritten in async_init_data_set_name_owner() on the
assumption that it will always be NULL when we get there. However,
on_name_owner_changed() can run first, and it does set name_owner.

==20126== 42 bytes in 6 blocks are definitely lost in loss record 15,174 of 48,256
==20126==    at 0x4C280F3: malloc (vg_replace_malloc.c:299)
==20126==    by 0x7541D00: g_malloc (gmem.c:104)
==20126==    by 0x7558FEE: g_strdup (gstrfuncs.c:364)
==20126==    by 0x6DF8E4F: on_name_owner_changed (gdbusproxy.c:1399)
==20126==    by 0x6DE94C4: emit_signal_instance_in_idle_cb (gdbusconnection.c:3743)
==20126==    by 0x753C315: g_main_dispatch (gmain.c:3066)
==20126==    by 0x753C315: g_main_context_dispatch (gmain.c:3642)
==20126==    by 0x753C667: g_main_context_iterate.isra.24 (gmain.c:3713)
==20126==    by 0x753CA69: g_main_loop_run (gmain.c:3907)
==20126==    by 0x5E38000: meta_run (main.c:556)
==20126==    by 0x401EC0: main (main.c:441)
parent 39a22880
......@@ -1454,8 +1454,9 @@ async_init_data_set_name_owner (GTask *task,
if (name_owner != NULL)
/* it starts as NULL anyway */
G_LOCK (properties_lock);
/* Must free first, since on_name_owner_changed() could run before us */
g_free (proxy->priv->name_owner);
proxy->priv->name_owner = g_strdup (name_owner);
G_UNLOCK (properties_lock);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment