changeset 25881:13d8b6c6ae42

applied changes from 8567515a55af9b920b1ff380fe95c5f9c138f4ec through 277dbfa504b60a873008deb330ed734a384e33f5 Patch from Stefan Becker to plug a couple of memory leaks in libpurple/mime.c References #9088
author Stu Tomlinson <stu@nosnilmot.com>
date Fri, 01 May 2009 16:05:55 +0000
parents 65e7395d420e
children 54dcfe059dd4
files COPYRIGHT libpurple/mime.c
diffstat 2 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/COPYRIGHT	Thu Apr 30 22:53:06 2009 +0000
+++ b/COPYRIGHT	Fri May 01 16:05:55 2009 +0000
@@ -30,6 +30,7 @@
 Derek Battams
 Martin Bayard
 Curtis Beattie
+Stefan Becker
 Dave Bell
 Igor Belyi
 Brian Bernas
--- a/libpurple/mime.c	Thu Apr 30 22:53:06 2009 +0000
+++ b/libpurple/mime.c	Fri May 01 16:05:55 2009 +0000
@@ -113,7 +113,7 @@
 fields_loadline(struct mime_fields *mf, const char *line, gsize len)
 {
 	/* split the line into key: value */
-	char *key, *val;
+	char *key, *newkey, *val;
 	char **tokens;
 
 	/* feh, need it to be NUL terminated */
@@ -129,17 +129,18 @@
 
 	/* normalize whitespace (sorta) and trim on key and value */
 	tokens = g_strsplit(key, "\t\r\n", 0);
-	key = g_strjoinv("", tokens);
-	key = g_strstrip(key);
+	newkey = g_strjoinv("", tokens);
+	g_strstrip(newkey);
 	g_strfreev(tokens);
 
 	tokens = g_strsplit(val, "\t\r\n", 0);
 	val = g_strjoinv("", tokens);
-	val = g_strstrip(val);
+	g_strstrip(val);
 	g_strfreev(tokens);
 
-	fields_set(mf, key, val);
+	fields_set(mf, newkey, val);
 
+	g_free(newkey);
 	g_free(key);
 	g_free(val);
 }
@@ -439,6 +440,8 @@
 
 		b = tail;
 	}
+
+	g_free(bnd);
 }