]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: avoid double-free
authorJim Meyering <meyering@redhat.com>
Mon, 14 Dec 2009 13:34:29 +0000 (14:34 +0100)
committerJim Meyering <meyering@redhat.com>
Mon, 14 Dec 2009 15:26:44 +0000 (16:26 +0100)
* 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

index 65525d439e4575e9d99f131c29e562ad15197d3c..8f96ca865c40437a197d69274ed408647af02386 100644 (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,