[glib] GDbusProxy: Plug memory leak.
- From: Hans Petter <hansp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] GDbusProxy: Plug memory leak.
- Date: Wed, 15 Jun 2016 14:39:53 +0000 (UTC)
commit ae048625fee3ece3898110f6034063aee6c84336
Author: Hans Petter Jansson <hpj cl no>
Date: Fri Jun 3 03:16:58 2016 +0200
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)
https://bugzilla.gnome.org/show_bug.cgi?id=755439
gio/gdbusproxy.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/gio/gdbusproxy.c b/gio/gdbusproxy.c
index 7b1140f..919f333 100644
--- a/gio/gdbusproxy.c
+++ b/gio/gdbusproxy.c
@@ -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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]