]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
vsh: Drop useless check for cmd != NULL
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 2 Jan 2018 13:33:45 +0000 (14:33 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 11 Jan 2018 17:53:04 +0000 (18:53 +0100)
All our internal *Free() functions are capable of handling NULL.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
tools/vsh.c

index e38dcec92d7e1a3ef43fae0f07e90793dedd28f2..a21e1d1dee9dd4fe7ff960d80a990ceece82835b 100644 (file)
@@ -1392,10 +1392,8 @@ vshCommandParse(vshControl *ctl, vshCommandParser *parser)
     vshCmd *clast = NULL;
     vshCmdOpt *first = NULL;
 
-    if (ctl->cmd) {
-        vshCommandFree(ctl->cmd);
-        ctl->cmd = NULL;
-    }
+    vshCommandFree(ctl->cmd);
+    ctl->cmd = NULL;
 
     while (1) {
         vshCmdOpt *last = NULL;
@@ -1576,10 +1574,8 @@ vshCommandParse(vshControl *ctl, vshCommandParser *parser)
     return true;
 
  syntaxError:
-    if (ctl->cmd) {
-        vshCommandFree(ctl->cmd);
-        ctl->cmd = NULL;
-    }
+    vshCommandFree(ctl->cmd);
+    ctl->cmd = NULL;
     vshCommandOptFree(first);
     VIR_FREE(tkdata);
     return false;