[anjuta] file-loader: Fix leak of plugin names in sort_wizards()



commit 5ba865890e86f4c0b3a64d193313feb4152f18b7
Author: Carl-Anton Ingmarsson <ca ingmarsson gmail com>
Date:   Wed Jan 9 20:57:04 2013 +0100

    file-loader: Fix leak of plugin names in sort_wizards()

 plugins/file-loader/plugin.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/plugins/file-loader/plugin.c b/plugins/file-loader/plugin.c
index 65334e5..61f57d2 100644
--- a/plugins/file-loader/plugin.c
+++ b/plugins/file-loader/plugin.c
@@ -46,7 +46,8 @@ static gpointer parent_class;
 static int
 sort_wizards(gconstpointer wizard1, gconstpointer wizard2)
 {
-	gchar* name1, *name2;
+	gchar* name1 = NULL, *name2 = NULL;
+	gint ret;
 	AnjutaPluginDescription* desc1 = (AnjutaPluginDescription*) wizard1;
 	AnjutaPluginDescription* desc2 = (AnjutaPluginDescription*) wizard2;
 
@@ -59,10 +60,15 @@ sort_wizards(gconstpointer wizard1, gconstpointer wizard2)
 			anjuta_plugin_description_get_locale_string (desc2, "Anjuta Plugin",
 														 "Name", &name2)))
 	{
-		return strcmp(name1, name2);
+		ret = strcmp(name1, name2);
 	}
 	else
-		return 0;
+		ret = 0;
+
+	g_free(name1);
+	g_free(name2);
+
+	return ret;
 }
 
 /* The add argument is here to remember that recent menu items should be removed



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