From a6d7ac8cb98df982d419602fdcbc41b68080369f Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Sat, 15 Nov 2014 19:40:44 +0100 Subject: [PATCH] wmaker: removed unnecessary null pointer check (Coverity #50041) As pointed by Coverity, the 'cmd' is checked for null at the beginning of the function, so the second case to handle the null pointer is not needed. This also means that 'command' cannot be null (wstrdup never returns null) so the code can also be simplified. Signed-off-by: Christophe CURIS Signed-off-by: Carlos R. Mafra --- src/dock.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/dock.c b/src/dock.c index bf6abd24..2b8925b2 100644 --- a/src/dock.c +++ b/src/dock.c @@ -1659,14 +1659,11 @@ static WAppIcon *restore_icon_state(WScreen *scr, WMPropList *info, int type, in return NULL; /* get commands */ - if (cmd) - command = wstrdup(WMGetFromPLString(cmd)); - else - command = NULL; + command = wstrdup(WMGetFromPLString(cmd)); + + if (strcmp(command, "-") == 0) { + wfree(command); - if (!command || strcmp(command, "-") == 0) { - if (command) - wfree(command); if (wclass) wfree(wclass); if (winstance) @@ -1680,8 +1677,8 @@ static WAppIcon *restore_icon_state(WScreen *scr, WMPropList *info, int type, in wfree(wclass); if (winstance) wfree(winstance); - if (command) - wfree(command); + + wfree(command); aicon->icon->core->descriptor.handle_mousedown = iconMouseDown; aicon->icon->core->descriptor.handle_enternotify = clipEnterNotify;