1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-20 21:08:08 +01:00

WMaker: fix memory leak in root menu parser (Coverity #50123 and #50124)

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.curis@free.fr>
This commit is contained in:
Christophe CURIS
2014-05-20 21:46:36 +02:00
committed by Carlos R. Mafra
parent 741243a792
commit 9f2f94a174

View File

@@ -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;