From: Michal Privoznik Date: Tue, 2 Jan 2018 13:33:45 +0000 (+0100) Subject: vsh: Drop useless check for cmd != NULL X-Git-Tag: v4.0.0-rc1~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f78440309364f3faeb05fc4c1fcaa9e397bad2bd;p=thirdparty%2Flibvirt.git vsh: Drop useless check for cmd != NULL All our internal *Free() functions are capable of handling NULL. Signed-off-by: Michal Privoznik --- diff --git a/tools/vsh.c b/tools/vsh.c index e38dcec92d..a21e1d1dee 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -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;