changeset 15666:6eda87b08cdf

Don't access the list element after it has been freed.
author Daniel Atallah <daniel.atallah@gmail.com>
date Mon, 19 Feb 2007 16:09:25 +0000
parents 95c4dee525f0
children 67ecb6a934a8
files libpurple/protocols/jabber/buddy.c
diffstat 1 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/buddy.c	Mon Feb 19 16:08:43 2007 +0000
+++ b/libpurple/protocols/jabber/buddy.c	Mon Feb 19 16:09:25 2007 +0000
@@ -602,11 +602,11 @@
 	/* Remove the timeout, which would otherwise trigger jabber_buddy_get_info_timeout() */
 	if (jbi->timeout_handle > 0)
 		gaim_timeout_remove(jbi->timeout_handle);
-	
+
 	g_free(jbi->jid);
 	g_hash_table_destroy(jbi->resources);
 	g_free(jbi->vcard_text);
-	g_free(jbi);	
+	g_free(jbi);
 }
 
 static void jabber_buddy_info_show_if_ready(JabberBuddyInfo *jbi)
@@ -694,7 +694,7 @@
 				gaim_notify_user_info_add_pair(user_info,
 											   _("Client"), tmp);
 				g_free(tmp);
-				
+
 				if(jbr->client.os) {
 					gaim_notify_user_info_add_pair(user_info, _("Operating System"), jbr->client.os);
 				}
@@ -726,14 +726,16 @@
 static void jabber_buddy_info_remove_id(JabberBuddyInfo *jbi, const char *id)
 {
 	GSList *l = jbi->ids;
+	char *comp_id;
 
 	if(!id)
 		return;
 
 	while(l) {
-		if(!strcmp(id, l->data)) {
-			jbi->ids = g_slist_remove(jbi->ids, l->data);
-			g_free(l->data);			
+		comp_id = l->data;
+		if(!strcmp(id, comp_id)) {
+			jbi->ids = g_slist_remove(jbi->ids, comp_id);
+			g_free(comp_id);
 			return;
 		}
 		l = l->next;
@@ -1093,7 +1095,7 @@
 			g_slist_free(jbi->ids);
 			jabber_buddy_info_destroy(jbi);
 
-			l = l->next;			
+			l = l->next;
 		}
 
 		g_slist_free(js->pending_buddy_info_requests);