From 4559cbbcccc2cecd0b557f36b18e9e578f1dfb76 Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Fri, 14 May 2021 20:17:04 +0200 Subject: [PATCH] WPrefs: Fix memory leak in the Menu tab As reported by Coverity (CID #331559), the call to 'wfindfile' replaces the value for variable 'path' but we did not free its previous content. Signed-off-by: Christophe CURIS --- WPrefs.app/Menu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/WPrefs.app/Menu.c b/WPrefs.app/Menu.c index afa145b8..79ff541b 100644 --- a/WPrefs.app/Menu.c +++ b/WPrefs.app/Menu.c @@ -1502,8 +1502,12 @@ static void showData(_Panel * panel) path = wexpandpath(WMGetFromPLString(pmenu)); - if (access(path, F_OK) < 0) + if (access(path, F_OK) < 0) { + char *old_path = path; + path = wfindfile(DEF_CONFIG_PATHS, path); + wfree(old_path); + } /* TODO: if needed, concatenate locale suffix to path. See getLocalizedMenuFile() in src/rootmenu.c. */