[glib] Don't leak resources in error cases



commit 6ac8e6108cf15884e28fe1ecd3042dfce0e11dfd
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Jun 14 10:12:46 2011 -0400

    Don't leak resources in error cases

 glib/gfileutils.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/glib/gfileutils.c b/glib/gfileutils.c
index c58ac47..a4a1db2 100644
--- a/glib/gfileutils.c
+++ b/glib/gfileutils.c
@@ -963,6 +963,7 @@ write_to_temp_file (const gchar  *contents,
 		   display_name, 
 		   g_strerror (save_errno));
 
+      fclose (file);
       g_unlink (tmp_name);
       
       goto out;
@@ -1006,6 +1007,7 @@ write_to_temp_file (const gchar  *contents,
 		     display_name,
 		     g_strerror (save_errno));
 
+        fclose (file);
 	g_unlink (tmp_name);
 
 	goto out;
@@ -1026,6 +1028,7 @@ write_to_temp_file (const gchar  *contents,
 		   display_name, 
 		   g_strerror (save_errno));
 
+      fclose (file);
       g_unlink (tmp_name);
       
       goto out;



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