ocarina: Free strings created by g_markup_escape_text()

This function returns a newly allocated string, so I can't set it
directly to a C++ string since this will leak memory.  Instead, I need
to keep the char* pointer around to free it.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
Bryan Schumaker 2012-02-08 08:19:48 -05:00
parent dce461656f
commit cefbf36415
1 changed files with 2 additions and 1 deletions

View File

@ -16,9 +16,10 @@ static list<NowPlayingWidgets> nowplaying_widgets;
static void set_label(GtkWidget *label, string text, string size)
{
string escaped = g_markup_escape_text(text.c_str(), -1);
char *escaped = g_markup_escape_text(text.c_str(), -1);
string markup = "<span size='" + size + "'>" + escaped + "</span>";
gtk_label_set_markup(GTK_LABEL(label), markup.c_str());
g_free(escaped);
}
static void set_now_playing(struct NowPlayingWidgets *widgets, string title,