[anjuta] am-project: Fix leak of GMatchInfo in split_automake_variable().



commit b884814ddc7112b68465a7772ad04ef61ebbbaba
Author: Carl-Anton Ingmarsson <ca ingmarsson gmail com>
Date:   Wed Jan 9 12:20:17 2013 +0100

    am-project: Fix leak of GMatchInfo in split_automake_variable().

 plugins/am-project/am-project.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/plugins/am-project/am-project.c b/plugins/am-project/am-project.c
index 793220f..809a62b 100644
--- a/plugins/am-project/am-project.c
+++ b/plugins/am-project/am-project.c
@@ -373,6 +373,7 @@ canonicalize_automake_variable (const gchar *name)
 gboolean
 split_automake_variable (gchar *name, gint *flags, gchar **module, gchar **primary)
 {
+	gboolean res = FALSE;
 	GRegex *regex;
 	GMatchInfo *match_info;
 	gint start_pos;
@@ -387,7 +388,8 @@ split_automake_variable (gchar *name, gint *flags, gchar **module, gchar **prima
 	                     G_REGEX_MATCH_ANCHORED,
 	                     NULL);
 
-	if (!g_regex_match (regex, name, G_REGEX_MATCH_ANCHORED, &match_info)) return FALSE;
+	if (!g_regex_match (regex, name, G_REGEX_MATCH_ANCHORED, &match_info))
+		goto out;
 
 	if (flags)
 	{
@@ -447,9 +449,13 @@ split_automake_variable (gchar *name, gint *flags, gchar **module, gchar **prima
 		}
 	}
 
+	res = TRUE;
+
+out:
+	g_match_info_unref (match_info);
 	g_regex_unref (regex);
 
-	return TRUE;
+	return res;
 }
 
 static gchar*



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