From 7a4d7fdd79699214d13870e4b590c9086ddb5ca5 Mon Sep 17 00:00:00 2001 From: Anton Lofgren Date: Fri, 30 May 2014 11:46:24 +0200 Subject: [PATCH] dbus: Fix iterator memory leak The manual for g_variant_iter_next_value states the following: "[..] Use g_variant_unref() to drop your reference on the return value when you no longer need it. [..]" https://developer.gnome.org/glib/unstable/glib-GVariant.html#g-variant-iter-next-value For most notifications (I guess), this is not a problem, since the leak is relatively tiny. However, for notifications that contain big chunks of binary data, such as those sent out by the new Spotify client, it adds up fast. The Spotify notifications in particular contain a rather large "icon_data" byte array (contained in a dict), which while never recorded is never-the-less iterated over and allocated, which in turn gives rise to issue #173. This fixes #173. --- dbus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbus.c b/dbus.c index 13edfcc..8221561 100644 --- a/dbus.c +++ b/dbus.c @@ -250,7 +250,7 @@ static void onNotify(GDBusConnection * connection, timeout = g_variant_get_int32(content); break; } - + g_variant_unref(content); idx++; } -- 1.9.1