From a0f6c347d8355a7e6a82e16f142e3baedf9aed37 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Thu, 8 Mar 2018 14:04:39 +0000 Subject: [PATCH 1/2] Fix memory leaks in pidgin_notify_searchresults_new_rows() We were failing to free the new results structure, and also by using g_value_set_string() we were allocating a redundant copy of each string which we were failing to clean up. Fixes #17292 --- pidgin/gtknotify.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pidgin/gtknotify.c b/pidgin/gtknotify.c index 60d7dd8..462c168 100644 --- a/pidgin/gtknotify.c +++ b/pidgin/gtknotify.c @@ -928,12 +928,18 @@ pidgin_notify_searchresults_new_rows(PurpleConnection *gc, PurpleNotifySearchRes v.g_type = 0; g_value_init(&v, G_TYPE_STRING); - g_value_set_string(&v, column->data); + g_value_set_static_string(&v, column->data); gtk_list_store_set_value(model, &iter, n, &v); n++; } } + /* The first set of results need to stick around, as we reference + * the buttons from there. But any updates from later calls to + * purple_notify_searchresults_new_rows() must be freed. */ + if (results != data->results) + purple_notify_searchresults_free(results); + if (pixbuf != NULL) g_object_unref(pixbuf); } -- 2.7.4