From: Jim Meyering Date: Mon, 14 Dec 2009 13:34:29 +0000 (+0100) Subject: virsh: avoid double-free X-Git-Tag: v0.7.5~82 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=21a2eba44fdbb9866e3c4db90e785eb34907e76f;p=thirdparty%2Flibvirt.git 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. --- 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,