Mercurial > pidgin.yaz
comparison libpurple/mime.c @ 26844:69d5d6ab4229
Patch from Stefan Becker to plug a couple of memory leaks in libpurple/mime.c
Closes #9088
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Fri, 01 May 2009 16:00:35 +0000 |
parents | 0c796a1950b7 |
children | ca7daa65bf0d |
comparison
equal
deleted
inserted
replaced
26843:4a592e898162 | 26844:69d5d6ab4229 |
---|---|
108 | 108 |
109 static void | 109 static void |
110 fields_loadline(struct mime_fields *mf, const char *line, gsize len) | 110 fields_loadline(struct mime_fields *mf, const char *line, gsize len) |
111 { | 111 { |
112 /* split the line into key: value */ | 112 /* split the line into key: value */ |
113 char *key, *val; | 113 char *key, *newkey, *val; |
114 char **tokens; | 114 char **tokens; |
115 | 115 |
116 /* feh, need it to be NUL terminated */ | 116 /* feh, need it to be NUL terminated */ |
117 key = g_strndup(line, len); | 117 key = g_strndup(line, len); |
118 | 118 |
124 } | 124 } |
125 *val++ = '\0'; | 125 *val++ = '\0'; |
126 | 126 |
127 /* normalize whitespace (sorta) and trim on key and value */ | 127 /* normalize whitespace (sorta) and trim on key and value */ |
128 tokens = g_strsplit(key, "\t\r\n", 0); | 128 tokens = g_strsplit(key, "\t\r\n", 0); |
129 key = g_strjoinv("", tokens); | 129 newkey = g_strjoinv("", tokens); |
130 key = g_strstrip(key); | 130 g_strstrip(newkey); |
131 g_strfreev(tokens); | 131 g_strfreev(tokens); |
132 | 132 |
133 tokens = g_strsplit(val, "\t\r\n", 0); | 133 tokens = g_strsplit(val, "\t\r\n", 0); |
134 val = g_strjoinv("", tokens); | 134 val = g_strjoinv("", tokens); |
135 val = g_strstrip(val); | 135 g_strstrip(val); |
136 g_strfreev(tokens); | 136 g_strfreev(tokens); |
137 | 137 |
138 fields_set(mf, key, val); | 138 fields_set(mf, newkey, val); |
139 | 139 |
140 g_free(newkey); | |
140 g_free(key); | 141 g_free(key); |
141 g_free(val); | 142 g_free(val); |
142 } | 143 } |
143 | 144 |
144 | 145 |
434 } | 435 } |
435 } | 436 } |
436 | 437 |
437 b = tail; | 438 b = tail; |
438 } | 439 } |
440 | |
441 g_free(bnd); | |
439 } | 442 } |
440 | 443 |
441 | 444 |
442 PurpleMimeDocument * | 445 PurpleMimeDocument * |
443 purple_mime_document_parsen(const char *buf, gsize len) | 446 purple_mime_document_parsen(const char *buf, gsize len) |