mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 21:08:08 +01:00
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:
committed by
Carlos R. Mafra
parent
741243a792
commit
9f2f94a174
@@ -627,6 +627,11 @@ static void constructMenu(WMenu * menu, WMenuEntry * entry)
|
|||||||
separateCommand((char *)entry->clientdata, &path, &cmd);
|
separateCommand((char *)entry->clientdata, &path, &cmd);
|
||||||
if (path == NULL || *path == NULL || **path == 0) {
|
if (path == NULL || *path == NULL || **path == 0) {
|
||||||
wwarning(_("invalid OPEN_MENU specification: %s"), (char *)entry->clientdata);
|
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)
|
if (cmd)
|
||||||
wfree(cmd);
|
wfree(cmd);
|
||||||
return;
|
return;
|
||||||
@@ -747,6 +752,11 @@ static void constructPLMenuFromPipe(WMenu * menu, WMenuEntry * entry)
|
|||||||
if (path == NULL || *path == NULL || **path == 0) {
|
if (path == NULL || *path == NULL || **path == 0) {
|
||||||
wwarning(_("invalid OPEN_PLMENU specification: %s"),
|
wwarning(_("invalid OPEN_PLMENU specification: %s"),
|
||||||
(char *)entry->clientdata);
|
(char *)entry->clientdata);
|
||||||
|
if (path) {
|
||||||
|
for (i = 0; path[i] != NULL; i++)
|
||||||
|
wfree(path[i]);
|
||||||
|
wfree(path);
|
||||||
|
}
|
||||||
if (cmd)
|
if (cmd)
|
||||||
wfree(cmd);
|
wfree(cmd);
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user