[totem-pl-parser/gnome-2-28] directories: Don't leak open files.



commit 6092580de083f439a81ddda0e8b585add215f58f
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 c945316..d031512 100644
--- a/plparse/totem-pl-parser-media.c
+++ b/plparse/totem-pl-parser-media.c
@@ -213,6 +213,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;
 	}
@@ -220,6 +222,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]