From: Christophe CURIS <[email protected]> As pointed by Coverity, the PLArray that is created to store the return value of the function 'processData' can be left allocated if some case handling decide to return NULL instead.
Signed-off-by: Christophe CURIS <[email protected]> --- WPrefs.app/Menu.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/WPrefs.app/Menu.c b/WPrefs.app/Menu.c index 59d407e..afe8700 100644 --- a/WPrefs.app/Menu.c +++ b/WPrefs.app/Menu.c @@ -1557,7 +1557,7 @@ static WMPropList *processData(const char *title, ItemData * data) switch (data->type) { case ExecInfo: if (data->param.exec.command == NULL) - return NULL; + goto return_null; #if 1 if (strpbrk(data->param.exec.command, "&$*|><?`=;")) { s1 = "SHEXEC"; @@ -1607,7 +1607,7 @@ static WMPropList *processData(const char *title, ItemData * data) case PipeInfo: case PLPipeInfo: if (!data->param.pipe.command) - return NULL; + goto return_null; if (data->type == PLPipeInfo) WMAddToPLArray(item, poplmenu); else @@ -1623,18 +1623,19 @@ static WMPropList *processData(const char *title, ItemData * data) case ExternalInfo: if (!data->param.external.path) - return NULL; + goto return_null; WMAddToPLArray(item, pomenu); WMAddToPLArray(item, WMCreatePLString(data->param.external.path)); break; case DirectoryInfo: - if (!data->param.directory.directory || !data->param.directory.command) - return NULL; { int l; char *tmp; + if (!data->param.directory.directory || !data->param.directory.command) + goto return_null; + l = strlen(data->param.directory.directory); l += strlen(data->param.directory.command); l += 32; @@ -1665,6 +1666,10 @@ static WMPropList *processData(const char *title, ItemData * data) } return item; + + return_null: + WMReleasePropList(item); + return NULL; } static WMPropList *processSubmenu(WEditMenu * menu) -- 1.9.2 -- To unsubscribe, send mail to [email protected].
