gui/playlist: Make sure we free text from tree_model_get()

Otherwise this leads to a memory leak.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2016-08-01 12:05:24 -04:00
parent e578e0e6dd
commit 44a6ad0d78
2 changed files with 8 additions and 6 deletions

View File

@ -1,3 +1,6 @@
6.4.17:
- Fix memory leak in __playlist_name()
6.4.17-rc:
- Filter can use GHashTables directly
- Filter can store track pointers instead of indexes

View File

@ -51,19 +51,18 @@ static void __playlist_add(GtkTreeIter *parent, const gchar *name,
static gchar *__playlist_name(GtkTreeIter *iter)
{
GtkTreeModel *model = GTK_TREE_MODEL(p_store);
gchar **split, *text, *name;
gchar *text, *parsed, *name, **split;
gtk_tree_model_get(model, iter, P_SB_NAME, &text, -1);
if (!text)
return NULL;
pango_parse_markup(text, -1, 0, NULL, &parsed, NULL, NULL);
split = g_strsplit(parsed, "\n", 2);
name = g_strdup(split[0]);
split = g_strsplit(text, "\n", 2);
text = g_strdup(split[0]);
g_strfreev(split);
pango_parse_markup(text, -1, 0, NULL, &name, NULL, NULL);
g_free(text);
g_free(parsed);
return name;
}