diff options
author | Chris Coulson <chrisccoulson@ubuntu.com> | 2011-03-10 00:43:07 +0000 |
---|---|---|
committer | Chris Coulson <chrisccoulson@ubuntu.com> | 2011-03-10 00:43:07 +0000 |
commit | ec307704b44db4f65f3534f23cfdf517c883a9e1 (patch) | |
tree | 878c02659ae6060788a5a2d38e7fe558357bebf5 | |
parent | da12001cce940316c26b8dc68da507f62ea689a7 (diff) | |
download | libdbusmenu-ec307704b44db4f65f3534f23cfdf517c883a9e1.tar.gz libdbusmenu-ec307704b44db4f65f3534f23cfdf517c883a9e1.tar.bz2 libdbusmenu-ec307704b44db4f65f3534f23cfdf517c883a9e1.zip |
Fix various memory leaks
-rw-r--r-- | libdbusmenu-glib/client.c | 11 | ||||
-rw-r--r-- | libdbusmenu-gtk/client.c | 4 | ||||
-rw-r--r-- | libdbusmenu-gtk/menuitem.c | 7 |
3 files changed, 11 insertions, 11 deletions
diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 61253e2..5ca52f4 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1213,7 +1213,9 @@ menuproxy_signal_cb (GDBusProxy * proxy, gchar * sender, gchar * signal, GVarian while (g_variant_iter_next(&properties, "s", &property)) { /* g_debug("Removing property '%s' on %d", property, id); */ dbusmenu_menuitem_property_remove(menuitem, property); + g_free(property); } + g_variant_unref(ritem); } GVariantIter items; @@ -1304,12 +1306,11 @@ menuitem_get_properties_replace_cb (GVariant * properties, GError * error, gpoin have_error = TRUE; } - GList * current_props = NULL; + GList * current_props = dbusmenu_menuitem_properties_list(DBUSMENU_MENUITEM(data)); + GList * tmp = NULL; - for (current_props = dbusmenu_menuitem_properties_list(DBUSMENU_MENUITEM(data)); - current_props != NULL && have_error == FALSE; - current_props = g_list_next(current_props)) { - dbusmenu_menuitem_property_remove(DBUSMENU_MENUITEM(data), (const gchar *)current_props->data); + for (tmp = current_props; tmp != NULL && have_error == FALSE; tmp = g_list_next(tmp)) { + dbusmenu_menuitem_property_remove(DBUSMENU_MENUITEM(data), (const gchar *)tmp->data); } g_list_free(current_props); diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index 50978ff..b7b201d 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -697,6 +697,7 @@ new_item_normal (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbusmenu if (gmi != NULL) { dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, gmi, parent); + g_object_unref(gmi); } else { return FALSE; } @@ -870,6 +871,9 @@ image_property_handle (DbusmenuMenuitem * item, const gchar * property, GVariant } else { gtk_image_set_from_pixbuf(GTK_IMAGE(gtkimage), image); } + if (image) { + g_object_unref(image); + } } } diff --git a/libdbusmenu-gtk/menuitem.c b/libdbusmenu-gtk/menuitem.c index 370dbf2..b3358fe 100644 --- a/libdbusmenu-gtk/menuitem.c +++ b/libdbusmenu-gtk/menuitem.c @@ -119,12 +119,7 @@ dbusmenu_menuitem_property_get_image (DbusmenuMenuitem * menuitem, const gchar * g_error_free(error); } - error = NULL; - g_input_stream_close(input, NULL, &error); - if (error != NULL) { - g_warning("Unable to close input stream: %s", error->message); - g_error_free(error); - } + g_object_unref(input); g_free(icondata); return icon; |