[gitg] Fix memory leaks in gitg_repository_get_remotes



commit c2386bfc41509e6683ed98d2274c9b0d2e0edbfd
Author: Edward Rudd <urkle outoforder cc>
Date:   Sat Jan 16 00:21:41 2010 -0500

    Fix memory leaks in gitg_repository_get_remotes

 gitg/gitg-repository.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/gitg/gitg-repository.c b/gitg/gitg-repository.c
index 2e01631..c2f23c4 100644
--- a/gitg/gitg-repository.c
+++ b/gitg/gitg-repository.c
@@ -1626,8 +1626,9 @@ gitg_repository_get_remotes (GitgRepository *repository)
 	gchar **lines = g_strsplit(ret, "\n", -1);
 	gchar **ptr = lines;
 
+	g_free (ret);
+
 	GRegex *regex = g_regex_new ("remote\\.(.+?)\\.url\\s+(.*)", 0, 0, NULL);
-	gint num = 0;
 
 	while (*ptr)
 	{
@@ -1647,6 +1648,7 @@ gitg_repository_get_remotes (GitgRepository *repository)
 	/* NULL terminate */
 	g_ptr_array_add (remotes, NULL);
 	g_object_unref (config);
+	g_strfreev (lines);
 
 	return (gchar **)g_ptr_array_free (remotes, FALSE);
 }



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