# HG changeset patch # User Daniel Atallah # Date 1191612235 0 # Node ID 16d372f412e324d8d1def0952f8a1dfb697b084e # Parent 6736c1168c503c1ba6a9be834047cd9e6d24f256 Fix a leak that occurs when getting the formatted buddy name under some conditions. diff -r 6736c1168c50 -r 16d372f412e3 pidgin/gtkblist.c --- 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("%s\n" - "%s%s%s", - dim_grey(), esc, dim_grey(), - idletime != NULL ? idletime : "", - (idletime != NULL && statustext != NULL) ? " - " : "", - statustext != NULL ? statustext : ""); + "%s%s%s", + 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("%s", dim_grey(), esc); - else if (!selected && !text) + } else if (!selected && !text) { + g_free(text); text = g_strdup_printf("%s\n" "%s", 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("%s", dim_grey(), esc); - else if (!selected && !text) + } else if (!selected && !text) text = g_strdup_printf("%s\n" "%s", 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" "%s%s%s", esc, idletime != NULL ? idletime : "", (idletime != NULL && statustext != NULL) ? " - " : "", statustext != NULL ? statustext : ""); + } g_free(idletime); g_free(statustext);