Mercurial > pidgin.yaz
comparison libpurple/protocols/jabber/buddy.c @ 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 | 0b16a4aa4e2b |
children | 32c366eeeb99 |
comparison
equal
deleted
inserted
replaced
15665:95c4dee525f0 | 15666:6eda87b08cdf |
---|---|
600 static void jabber_buddy_info_destroy(JabberBuddyInfo *jbi) | 600 static void jabber_buddy_info_destroy(JabberBuddyInfo *jbi) |
601 { | 601 { |
602 /* Remove the timeout, which would otherwise trigger jabber_buddy_get_info_timeout() */ | 602 /* Remove the timeout, which would otherwise trigger jabber_buddy_get_info_timeout() */ |
603 if (jbi->timeout_handle > 0) | 603 if (jbi->timeout_handle > 0) |
604 gaim_timeout_remove(jbi->timeout_handle); | 604 gaim_timeout_remove(jbi->timeout_handle); |
605 | 605 |
606 g_free(jbi->jid); | 606 g_free(jbi->jid); |
607 g_hash_table_destroy(jbi->resources); | 607 g_hash_table_destroy(jbi->resources); |
608 g_free(jbi->vcard_text); | 608 g_free(jbi->vcard_text); |
609 g_free(jbi); | 609 g_free(jbi); |
610 } | 610 } |
611 | 611 |
612 static void jabber_buddy_info_show_if_ready(JabberBuddyInfo *jbi) | 612 static void jabber_buddy_info_show_if_ready(JabberBuddyInfo *jbi) |
613 { | 613 { |
614 char *resource_name, *tmp; | 614 char *resource_name, *tmp; |
692 (jbr->client.version ? " " : ""), | 692 (jbr->client.version ? " " : ""), |
693 (jbr->client.version ? jbr->client.version : "")); | 693 (jbr->client.version ? jbr->client.version : "")); |
694 gaim_notify_user_info_add_pair(user_info, | 694 gaim_notify_user_info_add_pair(user_info, |
695 _("Client"), tmp); | 695 _("Client"), tmp); |
696 g_free(tmp); | 696 g_free(tmp); |
697 | 697 |
698 if(jbr->client.os) { | 698 if(jbr->client.os) { |
699 gaim_notify_user_info_add_pair(user_info, _("Operating System"), jbr->client.os); | 699 gaim_notify_user_info_add_pair(user_info, _("Operating System"), jbr->client.os); |
700 } | 700 } |
701 } | 701 } |
702 } | 702 } |
724 } | 724 } |
725 | 725 |
726 static void jabber_buddy_info_remove_id(JabberBuddyInfo *jbi, const char *id) | 726 static void jabber_buddy_info_remove_id(JabberBuddyInfo *jbi, const char *id) |
727 { | 727 { |
728 GSList *l = jbi->ids; | 728 GSList *l = jbi->ids; |
729 char *comp_id; | |
729 | 730 |
730 if(!id) | 731 if(!id) |
731 return; | 732 return; |
732 | 733 |
733 while(l) { | 734 while(l) { |
734 if(!strcmp(id, l->data)) { | 735 comp_id = l->data; |
735 jbi->ids = g_slist_remove(jbi->ids, l->data); | 736 if(!strcmp(id, comp_id)) { |
736 g_free(l->data); | 737 jbi->ids = g_slist_remove(jbi->ids, comp_id); |
738 g_free(comp_id); | |
737 return; | 739 return; |
738 } | 740 } |
739 l = l->next; | 741 l = l->next; |
740 } | 742 } |
741 } | 743 } |
1091 jbi = l->data; | 1093 jbi = l->data; |
1092 | 1094 |
1093 g_slist_free(jbi->ids); | 1095 g_slist_free(jbi->ids); |
1094 jabber_buddy_info_destroy(jbi); | 1096 jabber_buddy_info_destroy(jbi); |
1095 | 1097 |
1096 l = l->next; | 1098 l = l->next; |
1097 } | 1099 } |
1098 | 1100 |
1099 g_slist_free(js->pending_buddy_info_requests); | 1101 g_slist_free(js->pending_buddy_info_requests); |
1100 js->pending_buddy_info_requests = NULL; | 1102 js->pending_buddy_info_requests = NULL; |
1101 } | 1103 } |