patch: stream leak fix



Hi,

while trying to fix a monitoring problem for gnome-vfs mime user dir, I
found what I think is a stream leak in both write_back_keys_user_file
and write_back_mime_user_file..

Can I commit the attached patch (with changelog entry, of course..) ?
-- 
Frederic Crozat <fcrozat mandrakesoft com>
MandrakeSoft
--- gnome-vfs-2.1.3.1/libgnomevfs/gnome-vfs-mime-info.c.orig	2002-08-05 15:08:27.000000000 +0200
+++ gnome-vfs-2.1.3.1/libgnomevfs/gnome-vfs-mime-info.c	2002-12-04 15:39:04.000000000 +0100
@@ -1575,6 +1575,10 @@
 	if (dir == NULL) {
 		return gnome_vfs_result_from_errno ();
 	}
+	else {
+		/* don't forget to close the stream */
+		closedir (dir);
+	}
 
 	if (!user_mime_dir.system_dir) {
 		filename = g_strconcat (user_mime_dir.dirname, "/user.mime", NULL);
@@ -1631,6 +1635,10 @@
 	if (dir == NULL) {
 		return gnome_vfs_result_from_errno ();
 	}
+	else {
+		/* don't forget to close the stream */
+		closedir (dir);
+	}
 
 	if (!user_mime_dir.system_dir) {
 		filename = g_strconcat (user_mime_dir.dirname, "/user.keys", NULL);


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