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

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 <christophe.cu...@free.fr>
---
 src/dock.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/dock.c b/src/dock.c
index bf6abd2..2b8925b 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;
-- 
2.1.1


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

Reply via email to