Mercurial > pidgin.yaz
comparison libpurple/protocols/jabber/buddy.c @ 15627:0b16a4aa4e2b
Fixed 3 Jabber memory leaks: in jabber_roster_parse(), there's no need to g_strdup() this normalized jid since it's only used immediately, and there was no correspoding g_free(). When removing an id from jbi->ids, its data should always be freed. Finally, gaim_str_seconds_to_string() returns retained memory -- we must free the returned pointer when we're done using it.
author | Evan Schoenberg <evan.s@dreskin.net> |
---|---|
date | Tue, 13 Feb 2007 22:19:26 +0000 |
parents | 5fe8042783c1 |
children | 6eda87b08cdf |
comparison
equal
deleted
inserted
replaced
15626:fc586f7f23bd | 15627:0b16a4aa4e2b |
---|---|
640 } else { | 640 } else { |
641 gaim_notify_user_info_add_pair(user_info, _("Status"), _("Unknown")); | 641 gaim_notify_user_info_add_pair(user_info, _("Status"), _("Unknown")); |
642 } | 642 } |
643 if(jbir) { | 643 if(jbir) { |
644 if(jbir->idle_seconds > 0) { | 644 if(jbir->idle_seconds > 0) { |
645 gaim_notify_user_info_add_pair(user_info, _("Idle"), gaim_str_seconds_to_string(jbir->idle_seconds)); | 645 char *idle = gaim_str_seconds_to_string(jbir->idle_seconds); |
646 gaim_notify_user_info_add_pair(user_info, _("Idle"), idle); | |
647 g_free(idle); | |
646 } | 648 } |
647 } | 649 } |
648 if(jbr && jbr->client.name) { | 650 if(jbr && jbr->client.name) { |
649 tmp = g_strdup_printf("%s%s%s", jbr->client.name, | 651 tmp = g_strdup_printf("%s%s%s", jbr->client.name, |
650 (jbr->client.version ? " " : ""), | 652 (jbr->client.version ? " " : ""), |
678 if(jbr->name) | 680 if(jbr->name) |
679 jbir = g_hash_table_lookup(jbi->resources, jbr->name); | 681 jbir = g_hash_table_lookup(jbi->resources, jbr->name); |
680 | 682 |
681 if(jbir) { | 683 if(jbir) { |
682 if(jbir->idle_seconds > 0) { | 684 if(jbir->idle_seconds > 0) { |
683 gaim_notify_user_info_add_pair(user_info, _("Idle"), gaim_str_seconds_to_string(jbir->idle_seconds)); | 685 char *idle = gaim_str_seconds_to_string(jbir->idle_seconds); |
686 gaim_notify_user_info_add_pair(user_info, _("Idle"), idle); | |
687 g_free(idle); | |
684 } | 688 } |
685 } | 689 } |
686 if(jbr && jbr->client.name) { | 690 if(jbr && jbr->client.name) { |
687 tmp = g_strdup_printf("%s%s%s", jbr->client.name, | 691 tmp = g_strdup_printf("%s%s%s", jbr->client.name, |
688 (jbr->client.version ? " " : ""), | 692 (jbr->client.version ? " " : ""), |
727 return; | 731 return; |
728 | 732 |
729 while(l) { | 733 while(l) { |
730 if(!strcmp(id, l->data)) { | 734 if(!strcmp(id, l->data)) { |
731 jbi->ids = g_slist_remove(jbi->ids, l->data); | 735 jbi->ids = g_slist_remove(jbi->ids, l->data); |
736 g_free(l->data); | |
732 return; | 737 return; |
733 } | 738 } |
734 l = l->next; | 739 l = l->next; |
735 } | 740 } |
736 } | 741 } |