Fix double free when both allow_markup and parse_search are enabled

If out is not initialised, GLib will attempt to free the string automagically
later, leading to a crash. To reproduce, try running

wofi --define parse_search=true --define allow_markup=true --show dmenu,drun
This commit is contained in:
Jonas Witschel 2020-04-23 14:44:02 +02:00
parent de40550d2f
commit 023fe67c5b

View File

@ -384,7 +384,7 @@ static GtkWidget* create_label(char* mode, char* text, char* search_text, char*
free(tmp); free(tmp);
} }
if(allow_markup) { if(allow_markup) {
char* out; char* out = NULL;
pango_parse_markup(search_text, -1, 0, NULL, &out, NULL, NULL); pango_parse_markup(search_text, -1, 0, NULL, &out, NULL, NULL);
free(search_text); free(search_text);
search_text = out; search_text = out;