[totem-pl-parser] directories: Don't leak open files.



commit 8cd60a46cc802a16e05fdc3556802a11c6623efe
Author: Edward Hervey <bilboed bilboed com>
Date:   Sun Mar 7 11:30:28 2010 +0100

    directories: Don't leak open files.
    
    The GFileEnumerator wasn't properly closed/unreferenced, causing the fd for
    the directories to be left opened.
    When opening very big media collections, we would end up being out of fd.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=612067

 plparse/totem-pl-parser-media.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/plparse/totem-pl-parser-media.c b/plparse/totem-pl-parser-media.c
index 27d5f6e..768f34c 100644
--- a/plparse/totem-pl-parser-media.c
+++ b/plparse/totem-pl-parser-media.c
@@ -214,6 +214,8 @@ totem_pl_parser_load_directory (GFile *file, GList **list, gboolean *unhandled)
 	if (e == NULL) {
 		if (g_error_matches (err, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED) != FALSE)
 			*unhandled = TRUE;
+		g_file_enumerator_close (e, NULL, NULL);
+		g_object_unref (e);
 		g_error_free (err);
 		return FALSE;
 	}
@@ -221,6 +223,8 @@ totem_pl_parser_load_directory (GFile *file, GList **list, gboolean *unhandled)
 	while ((info = g_file_enumerator_next_file (e, NULL, NULL)) != NULL)
 		*list = g_list_prepend (*list, info);
 
+	g_file_enumerator_close (e, NULL, NULL);
+	g_object_unref (e);
 	return TRUE;
 }
 



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