changeset 27708:b5e52173ef67

Free the KeyValuePairs associated with accountopt lists. Closes #9115. Patch from Stefan Becker with minor addition by me. committer: Paul Aurich <paul@darkrain42.org>
author stefan.becker@nokia.com
date Mon, 27 Jul 2009 23:14:24 +0000
parents b6f26015c51c
children 9776f3c01268
files ChangeLog libpurple/accountopt.c
diffstat 2 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Jul 27 22:50:34 2009 +0000
+++ b/ChangeLog	Mon Jul 27 23:14:24 2009 +0000
@@ -10,7 +10,8 @@
 	  in a group on the buddy list.
 	* Removed the unmaintained and unneeded toc protocol plugin.
 	* Fixed NTLM authentication on big-endian systems.
-	* Various memory cleanups when unloading libpurple. (Nick Hebner)
+	* Various memory cleanups when unloading libpurple. (Nick Hebner and
+	  Stefan Becker)
 	* Report idle time 'From last message sent' should work properly.
 	* DNS servers are re-read when DNS queries fail in case the system has
 	  moved to a new network and the old servers are not accessible.
--- a/libpurple/accountopt.c	Mon Jul 27 22:50:34 2009 +0000
+++ b/libpurple/accountopt.c	Mon Jul 27 23:14:24 2009 +0000
@@ -111,6 +111,16 @@
 	return option;
 }
 
+static void
+purple_account_option_list_free(gpointer data, gpointer user_data)
+{
+	PurpleKeyValuePair *kvp = data;
+
+	g_free(kvp->value);
+	g_free(kvp->key);
+	g_free(kvp);
+}
+
 void
 purple_account_option_destroy(PurpleAccountOption *option)
 {
@@ -127,7 +137,7 @@
 	{
 		if (option->default_value.list != NULL)
 		{
-			g_list_foreach(option->default_value.list, (GFunc)g_free, NULL);
+			g_list_foreach(option->default_value.list, purple_account_option_list_free, NULL);
 			g_list_free(option->default_value.list);
 		}
 	}
@@ -183,7 +193,7 @@
 
 	if (option->default_value.list != NULL)
 	{
-		g_list_foreach(option->default_value.list, (GFunc)g_free, NULL);
+		g_list_foreach(option->default_value.list, purple_account_option_list_free, NULL);
 		g_list_free(option->default_value.list);
 	}