From 45f3f5d0aea97605158d419d4c9ced62d4110d25 Mon Sep 17 00:00:00 2001 From: David Maciejak Date: Sat, 4 Mar 2023 12:10:57 +0800 Subject: [PATCH] Util: fix wmgenmenu memory leak and help msg Memory allocated from wstrconcat() calls are not freed properly. Help msg is reporting the wrong directory where to install WMRootMenu. --- util/wmgenmenu.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/util/wmgenmenu.c b/util/wmgenmenu.c index 25076499..c345ccf0 100644 --- a/util/wmgenmenu.c +++ b/util/wmgenmenu.c @@ -379,8 +379,14 @@ int main(int argc, char *argv[]) ); WMAddToPLArray(RMenu, L1Menu); - printf("%s", WMGetPropListDescription(RMenu, True)); - puts(""); + wfree(tmp); + wfree(theme_paths); + wfree(style_paths); + wfree(icon_paths); + + tmp = WMGetPropListDescription(RMenu, True); + printf("%s\n", tmp); + wfree(tmp); return 0; } @@ -504,7 +510,7 @@ noreturn void print_help(int print_usage, int exitval) { printf("Usage: %s [-h] [-v]\n", prog_name); if (print_usage) { - puts("Writes a menu structure usable as ~/" GSUSER_SUBDIR "/" USERDATA_SUBDIR "/WMRootMenu to stdout"); + puts("Writes a menu structure usable as ~/" GSUSER_SUBDIR "/" DEFAULTS_SUBDIR "/WMRootMenu to stdout"); puts(""); puts(" -h, --help display this help and exit"); puts(" -v, --version output version information and exit");