From: Christophe CURIS <christophe.cu...@free.fr>

As pointed by Coverity, if an invalid OPEN_MENU is used then the memory
allocated when parsing the line containing it would be leaked.

Signed-off-by: Christophe CURIS <christophe.cu...@free.fr>
---
 src/rootmenu.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/rootmenu.c b/src/rootmenu.c
index 8f0723c..a922f5e 100644
--- a/src/rootmenu.c
+++ b/src/rootmenu.c
@@ -627,6 +627,11 @@ static void constructMenu(WMenu * menu, WMenuEntry * entry)
        separateCommand((char *)entry->clientdata, &path, &cmd);
        if (path == NULL || *path == NULL || **path == 0) {
                wwarning(_("invalid OPEN_MENU specification: %s"), (char 
*)entry->clientdata);
+               if (path) {
+                       for (i = 0; path[i] != NULL; i++)
+                               wfree(path[i]);
+                       wfree(path);
+               }
                if (cmd)
                        wfree(cmd);
                return;
@@ -747,6 +752,11 @@ static void constructPLMenuFromPipe(WMenu * menu, 
WMenuEntry * entry)
        if (path == NULL || *path == NULL || **path == 0) {
                wwarning(_("invalid OPEN_PLMENU specification: %s"),
                    (char *)entry->clientdata);
+               if (path) {
+                       for (i = 0; path[i] != NULL; i++)
+                               wfree(path[i]);
+                       wfree(path);
+               }
                if (cmd)
                        wfree(cmd);
                return;
-- 
1.9.2


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to