]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Fix leak in qemuParseCommandLine on OOM
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 24 Sep 2013 15:37:24 +0000 (16:37 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Wed, 25 Sep 2013 14:49:28 +0000 (15:49 +0100)
If the call to virDomainControllerInsert fails in
qemuParseCommandLine, the controller struct is leaked.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
src/qemu/qemu_command.c

index 4b4f9c92b0d58c33337de57ed3a3fbf2927c9985..1f9a999760635df35b5ac0d9c8410d8007a9cbf1 100644 (file)
@@ -11725,8 +11725,10 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
             ctldef->type = VIR_DOMAIN_CONTROLLER_TYPE_USB;
             ctldef->idx = 0;
             ctldef->model = -1;
-            if (virDomainControllerInsert(def, ctldef) < 0)
+            if (virDomainControllerInsert(def, ctldef) < 0) {
+                VIR_FREE(ctldef);
                 goto error;
+            }
         } else if (STREQ(arg, "-pidfile")) {
             WANT_VALUE();
             if (pidfile)