提交 3ebbc241 编写于 作者: C Chris Lalancette 提交者: Daniel Veillard

Fix crash in virsh after bogus command

If you ran virsh in interactive mode and ran a command
that virsh could not parse, it would then SEGV
on subsequent commands.  The problem is that we are
freeing the vshCmd structure in the syntaxError label
at the end of vshCommandParse, but forgetting to
set ctl->cmd to NULL.  This means that on the next command,
we would try to free the same structure again, leading
to badness.

* tools/virsh.c: Make sure to set ctl->cmd to NULL after
  freeing it in vshCommandParse()
上级 be2a53e6
......@@ -8639,8 +8639,10 @@ vshCommandParse(vshControl *ctl, char *cmdstr)
return TRUE;
syntaxError:
if (ctl->cmd)
if (ctl->cmd) {
vshCommandFree(ctl->cmd);
ctl->cmd = NULL;
}
if (first)
vshCommandOptFree(first);
VIR_FREE(tkdata);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册