From: Max Kellermann Date: Fri, 7 Nov 2008 15:14:32 +0000 (+0100) Subject: screen_search: fixed 2 memory leaks X-Git-Tag: v0.12_alpha1~21 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=06aafa1328f50d247676c2eca488e53fa02c0dbd;p=ncmpc.git screen_search: fixed 2 memory leaks Free the old pattern before prompting for a new one. Free the old filelist object before retrieving the new one. --- diff --git a/src/screen_search.c b/src/screen_search.c index 4e2f922..51a8a29 100644 --- a/src/screen_search.c +++ b/src/screen_search.c @@ -304,6 +304,7 @@ search_new(mpdclient_t *c) { search_clear(c, TRUE); + g_free(pattern); pattern = screen_readln(screen.status_window.w, _("Search: "), NULL, @@ -320,6 +321,11 @@ search_new(mpdclient_t *c) return; } + if (browser.filelist != NULL) { + filelist_free(browser.filelist); + browser.filelist = NULL; + } + if (!MPD_VERSION_LT(c, 0, 12, 0)) browser.filelist = search_advanced_query(pattern, c);