Skip to content

Commit

Permalink
Merge branch 'leak' into 'master'
Browse files Browse the repository at this point in the history
Plug memory leak

Bumped into it while debugging mms-engine:
```
==14981== 72 bytes in 3 blocks are definitely lost in loss record 2,926 of 3,087
==14981==    at 0x483F380: malloc (vg_replace_malloc.c:296)
==14981==    by 0x515E083: g_malloc (gmem.c:104)
==14981==    by 0x51749B5: g_slice_alloc (gslice.c:1016)
==14981==    by 0x5191555: g_variant_alloc (gvariant-core.c:478)
==14981==    by 0x5191555: g_variant_new_from_children (gvariant-core.c:567)
==14981==    by 0x518F009: g_variant_builder_end (gvariant.c:3654)
==14981==    by 0x519083B: g_variant_valist_new (gvariant.c:4624)
==14981==    by 0x51909B7: g_variant_new_va (gvariant.c:4778)
==14981==    by 0x5190AD3: g_variant_new (gvariant.c:4717)
==14981==    by 0x111B3: org_nemomobile_mms_engine_complete_push (org.nemomobile.MmsEngine.c:2389)
==14981==    by 0x1491B: mms_engine_handle_push_notify (mms_engine.c:332)
==14981==    by 0x14A07: mms_engine_handle_push (mms_engine.c:359)
==14981==    by 0x5A4DA5B: ffi_call_VFP (in /usr/lib/libffi.so.5.0.10)
```
The leak was introduced in commit aec9288

See merge request !2
  • Loading branch information
stskeeps committed Jan 31, 2016
2 parents 9f89b56 + cde56a1 commit ddd86ba
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions rpm/gdbus-no-reply-expected.patch
@@ -1,8 +1,18 @@
diff --git a/gio/gdbusmethodinvocation.c b/gio/gdbusmethodinvocation.c
index c6cab91..26c04ee 100644
index c6cab91..35ab771 100644
--- a/gio/gdbusmethodinvocation.c
+++ b/gio/gdbusmethodinvocation.c
@@ -479,6 +479,9 @@ g_dbus_method_invocation_return_value_internal (GDBusMethodInvocation *invocatio
@@ -398,6 +398,9 @@ g_dbus_method_invocation_return_value_internal (GDBusMethodInvocation *invocatio
if (parameters == NULL)
parameters = g_variant_new_tuple (NULL, 0);

+ /* Make sure that we don't lose the reference, floating or not */
+ g_variant_ref_sink(parameters);
+
/* if we have introspection data, check that the signature of @parameters is correct */
if (invocation->method_info != NULL)
{
@@ -479,6 +482,9 @@ g_dbus_method_invocation_return_value_internal (GDBusMethodInvocation *invocatio
g_assert_not_reached ();
}

Expand All @@ -12,3 +22,11 @@ index c6cab91..26c04ee 100644
if (G_UNLIKELY (_g_dbus_debug_return ()))
{
_g_dbus_debug_print_lock ();
@@ -513,6 +519,7 @@ g_dbus_method_invocation_return_value_internal (GDBusMethodInvocation *invocatio
g_object_unref (reply);

out:
+ g_variant_unref(parameters);
g_object_unref (invocation);
}

0 comments on commit ddd86ba

Please sign in to comment.