[totem] Fix some memory leaks in volume handling



commit 3a4945d16b025bc9042075dd09230fa8a657708e
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Nov 26 16:49:37 2009 +0000

    Fix some memory leaks in volume handling

 src/totem-menu.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/totem-menu.c b/src/totem-menu.c
index 6149a10..2cdf42c 100644
--- a/src/totem-menu.c
+++ b/src/totem-menu.c
@@ -902,6 +902,7 @@ add_drive_to_menu (GDrive *drive, guint position, Totem *totem)
 	for (i = volumes; i != NULL; i = i->next) {
 		GVolume *volume = i->data;
 		add_volume_to_menu (volume, drive, theme, position, totem);
+		g_object_unref (volume);
 	}
 
 	g_list_free (volumes);
@@ -918,14 +919,17 @@ update_drive_menu_items (GtkMenuItem *movie_menuitem, Totem *totem)
 
 	drives = g_volume_monitor_get_connected_drives (totem->monitor);
 	for (i = drives; i != NULL; i = i->next) {
+		GDrive *drive = i->data;
+
 		/* FIXME: We used to explicitly check whether it was a CD/DVD drive
 		 * Use:
 		 * udi = g_volume_get_identifier (i->data, G_VOLUME_IDENTIFIER_KIND_HAL_UDI); */
-		if (g_drive_can_eject (i->data) == FALSE)
+		if (g_drive_can_eject (drive) == FALSE)
 			continue;
 
 		position++;
-		add_drive_to_menu (i->data, position, totem);
+		add_drive_to_menu (drive, position, totem);
+		g_object_unref (drive);
 	}
 	g_list_free (drives);
 



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