pidgin: dd0f26da: Fix some leaks in XMPP caps hashing, as ...

qulogic at pidgin.im qulogic at pidgin.im
Thu Dec 22 04:42:08 EST 2011


----------------------------------------------------------------------
Revision: dd0f26da1468ff9191145d98d6b4d45d89e36e2a
Parent:   077ded4f640982ce1cb77ac791bfc02f8ea7ea67
Author:   qulogic at pidgin.im
Date:     12/22/11 01:28:12
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/dd0f26da1468ff9191145d98d6b4d45d89e36e2a

Changelog: 

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.

Changes against parent 077ded4f640982ce1cb77ac791bfc02f8ea7ea67

  patched  libpurple/protocols/jabber/caps.c

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/caps.c	ec1ad57734fecc5bc95cc152bb375a412459b1a5
+++ libpurple/protocols/jabber/caps.c	7df7bbfd5814bc8322feaa0a154dc685f7f017cf
@@ -875,21 +875,24 @@ gchar *jabber_caps_calculate_hash(Jabber
 		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);
 		}


More information about the Commits mailing list