]> git.0d.be Git - empathy.git/commitdiff
menu_removed_cb: fix 'name' leak
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Wed, 11 Sep 2013 14:27:04 +0000 (16:27 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Wed, 25 Sep 2013 13:21:50 +0000 (15:21 +0200)
https://bugzilla.gnome.org/show_bug.cgi?id=707885

src/empathy-roster-window.c

index 9dd7a4e750b2f7daced22300b24c98a3b89754d1..667267f5119496a1bf91db505b15da39689de871 100644 (file)
@@ -1360,16 +1360,22 @@ roster_window_favorite_chatroom_menu_removed_cb (
 
   for (i = 0; i < n; i++)
     {
 
   for (i = 0; i < n; i++)
     {
-      const gchar *name;
+      gchar *name;
 
 
-      if (g_menu_model_get_item_attribute (
-            G_MENU_MODEL (self->priv->rooms_section), i, "room-name",
-            "s", &name)
-          && !tp_strdiff (name, empathy_chatroom_get_name (chatroom)))
+      if (!g_menu_model_get_item_attribute (
+            G_MENU_MODEL (self->priv->rooms_section), i,
+            "room-name", "s", &name))
+        continue;
+
+      if (tp_strdiff (name, empathy_chatroom_get_name (chatroom)))
         {
         {
-          g_menu_remove (self->priv->rooms_section, i);
-          break;
+          g_free (name);
+          continue;
         }
         }
+
+      g_menu_remove (self->priv->rooms_section, i);
+      g_free (name);
+      break;
     }
 
   chatrooms = empathy_chatroom_manager_get_chatrooms (
     }
 
   chatrooms = empathy_chatroom_manager_get_chatrooms (