Mercurial > pidgin.yaz
changeset 20793:16d372f412e3
Fix a leak that occurs when getting the formatted buddy name under some conditions.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Fri, 05 Oct 2007 19:23:55 +0000 |
parents | 6736c1168c50 |
children | 366204358e93 |
files | pidgin/gtkblist.c |
diffstat | 1 files changed, 19 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkblist.c Fri Oct 05 16:22:03 2007 +0000 +++ b/pidgin/gtkblist.c Fri Oct 05 19:23:55 2007 +0000 @@ -3663,25 +3663,31 @@ else idletime = g_strdup(_("Idle")); - if (!selected) + if (!selected) { + g_free(text); text = g_strdup_printf("<span color='%s'>%s</span>\n" - "<span color='%s' size='smaller'>%s%s%s</span>", - dim_grey(), esc, dim_grey(), - idletime != NULL ? idletime : "", - (idletime != NULL && statustext != NULL) ? " - " : "", - statustext != NULL ? statustext : ""); + "<span color='%s' size='smaller'>%s%s%s</span>", + dim_grey(), esc, dim_grey(), + idletime != NULL ? idletime : "", + (idletime != NULL && statustext != NULL) ? " - " : "", + statustext != NULL ? statustext : ""); + } } - else if (!selected && !statustext) /* We handle selected text later */ + else if (!selected && !statustext) {/* We handle selected text later */ + g_free(text); text = g_strdup_printf("<span color='%s'>%s</span>", dim_grey(), esc); - else if (!selected && !text) + } else if (!selected && !text) { + g_free(text); text = g_strdup_printf("<span color='%s'>%s</span>\n" "<span color='%s' size='smaller'>%s</span>", dim_grey(), esc, dim_grey(), statustext != NULL ? statustext : ""); + } } else if (!PURPLE_BUDDY_IS_ONLINE(b)) { - if (!selected && !statustext) /* We handle selected text later */ + if (!selected && !statustext) {/* We handle selected text later */ + g_free(text); text = g_strdup_printf("<span color='%s'>%s</span>", dim_grey(), esc); - else if (!selected && !text) + } else if (!selected && !text) text = g_strdup_printf("<span color='%s'>%s</span>\n" "<span color='%s' size='smaller'>%s</span>", dim_grey(), esc, dim_grey(), @@ -3698,13 +3704,15 @@ } /* It is selected. */ - if ((selected && !text) || (selected && idletime)) + if ((selected && !text) || (selected && idletime)) { + g_free(text); text = g_strdup_printf("%s\n" "<span size='smaller'>%s%s%s</span>", esc, idletime != NULL ? idletime : "", (idletime != NULL && statustext != NULL) ? " - " : "", statustext != NULL ? statustext : ""); + } g_free(idletime); g_free(statustext);