# HG changeset patch # User Stu Tomlinson # Date 1241193635 0 # Node ID 69d5d6ab4229eb9d18427e5e952f9f1aba716165 # Parent 4a592e89816291f8543a2cbea1d1e03df1f7126d Patch from Stefan Becker to plug a couple of memory leaks in libpurple/mime.c Closes #9088 diff -r 4a592e898162 -r 69d5d6ab4229 COPYRIGHT --- a/COPYRIGHT Thu Apr 30 14:44:01 2009 +0000 +++ b/COPYRIGHT Fri May 01 16:00:35 2009 +0000 @@ -30,6 +30,7 @@ Derek Battams Martin Bayard Curtis Beattie +Stefan Becker Carlos Bederian Dave Bell Igor Belyi diff -r 4a592e898162 -r 69d5d6ab4229 libpurple/mime.c --- a/libpurple/mime.c Thu Apr 30 14:44:01 2009 +0000 +++ b/libpurple/mime.c Fri May 01 16:00:35 2009 +0000 @@ -110,7 +110,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 */ @@ -126,17 +126,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); } @@ -436,6 +437,8 @@ b = tail; } + + g_free(bnd); }