[gnome-flashback] notifications: fix memory leak



commit 127bd4bdddd168c8194a25ebf2084daf5c71b672
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Wed Apr 27 22:39:57 2016 +0300

    notifications: fix memory leak

 gnome-flashback/libnotifications/nd-notification.c |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)
---
diff --git a/gnome-flashback/libnotifications/nd-notification.c 
b/gnome-flashback/libnotifications/nd-notification.c
index 36f3480..aec0330 100644
--- a/gnome-flashback/libnotifications/nd-notification.c
+++ b/gnome-flashback/libnotifications/nd-notification.c
@@ -182,17 +182,15 @@ nd_notification_update (NdNotification     *notification,
 
         g_variant_iter_init (&iter, hints);
         while ((item = g_variant_iter_next_value (&iter))) {
-                const char *key;
-                GVariant   *value;
+                gchar *key;
+                GVariant *value;
 
-                g_variant_get (item,
-                               "{sv}",
-                               &key,
-                               &value);
+                g_variant_get (item, "{sv}", &key, &value);
+                g_hash_table_insert (notification->hints, g_strdup (key),
+                                     g_variant_ref (value));
 
-                g_hash_table_insert (notification->hints,
-                                     g_strdup (key),
-                                     value); /* steals value */
+                g_variant_unref (value);
+                g_free (key);
         }
 
         notification->timeout = timeout;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]