From 21a2eba44fdbb9866e3c4db90e785eb34907e76f Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Mon, 14 Dec 2009 14:34:29 +0100 Subject: [PATCH] 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. --- tools/virsh.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/virsh.c b/tools/virsh.c index 65525d439e..8f96ca865c 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -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,