From 97a9300aa47822ea15a8d423b1cdfb2b6d346fc0 Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Fri, 14 May 2021 19:36:33 +0200 Subject: [PATCH] Fix memory leak reported by Coverity As reported in CID #331577, we re-use the variable 'tmp' without freeing the previously allocated pointer. Signed-off-by: Christophe CURIS --- src/rootmenu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/rootmenu.c b/src/rootmenu.c index f391fc60..f2aa05df 100644 --- a/src/rootmenu.c +++ b/src/rootmenu.c @@ -673,9 +673,13 @@ static void constructMenu(WMenu * menu, WMenuEntry * entry) tmp = wexpandpath(path[i]); - if (strstr(tmp, "#usergnusteppath#") == tmp) + if (strstr(tmp, "#usergnusteppath#") == tmp) { + char *old_tmp = tmp; + tmp = wstrconcat(wusergnusteppath(), tmp + 17); + wfree(old_tmp); + } wfree(path[i]); lpath = getLocalizedMenuFile(tmp);