virsh: avoid double-free

* tools/virsh.c (vshCommandParse): Avoid double-free of "tkdata".
Set it to NULL immediately after free in the (cmd == NULL) case,
just as in the other case, in case the final free(tkdata) is
triggered by a syntax error.
This commit is contained in:
Jim Meyering 2009-12-14 14:34:29 +01:00
parent b148318981
commit 21a2eba44f

View File

@ -8049,6 +8049,7 @@ vshCommandParse(vshControl *ctl, char *cmdstr)
goto syntaxError; /* ... or ignore this command only? */
}
free(tkdata);
tkdata = NULL;
} else if (tk == VSH_TK_OPTION) {
if (!(opt = vshCmddefGetOption(cmd, tkdata))) {
vshError(ctl,