[gedit] Fix a memory leak



commit 33ce3ab0da2b9b75b3d5fb9966cd579d7c73a7a6
Author: Daniel Trebbien <dtrebbien gmail com>
Date:   Tue Feb 14 14:47:57 2012 -0500

    Fix a memory leak
    
    In init_fifo(), `tmp` needs to be freed before returning.
    
    See:
    http://developer.gnome.org/glib/stable/glib-File-Utilities.html#g-file-open-tmp
    
    https://bugzilla.gnome.org/show_bug.cgi?id=670095

 gedit/gedit-fifo.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/gedit/gedit-fifo.c b/gedit/gedit-fifo.c
index b638ab3..3134fc0 100644
--- a/gedit/gedit-fifo.c
+++ b/gedit/gedit-fifo.c
@@ -161,6 +161,7 @@ init_fifo (GeditFifo *fifo)
 
 	if (g_unlink (tmp) == -1)
 	{
+		g_free (tmp);
 		return;
 	}
 
@@ -168,10 +169,12 @@ init_fifo (GeditFifo *fifo)
 	{
 		g_warning ("Could not create named pipe for standard in: %s",
 		           strerror (errno));
+		g_free (tmp);
 		return;
 	}
 
 	fifo->priv->file = g_file_new_for_path (tmp);
+	g_free (tmp);
 }
 
 static void



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