Mercurial > pidgin
changeset 32405:e4af50513560
Fix some leaks in XMPP caps hashing, as pointed out by max ulidtko.
However, I didn't really apply his patch specifically, and made some
other optimizations while I was there.
Fixes #14701.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Thu, 22 Dec 2011 06:28:12 +0000 |
parents | 55da4c7f06bf |
children | 6ee168374b2b |
files | libpurple/protocols/jabber/caps.c |
diffstat | 1 files changed, 8 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/caps.c Thu Dec 22 06:14:38 2011 +0000 +++ b/libpurple/protocols/jabber/caps.c Thu Dec 22 06:28:12 2011 +0000 @@ -875,21 +875,24 @@ g_free(formtype); while (fields) { - GList *value; JabberDataFormField *field = (JabberDataFormField*)fields->data; if (!g_str_equal(field->var, "FORM_TYPE")) { /* Append the "var" attribute */ append_escaped_string(context, field->var); /* Append <value/> elements' cdata */ - for (value = field->values; value; value = value->next) { - append_escaped_string(context, value->data); - g_free(value->data); + while (field->values) { + append_escaped_string(context, field->values->data); + g_free(field->values->data); + field->values = g_list_delete_link(field->values, + field->values); } + } else { + g_list_free_full(field->values, g_free); } g_free(field->var); - g_list_free(field->values); + g_free(field); fields = g_list_delete_link(fields, fields); }