[libvirt] [PATCH 12/17] Fix leak in qemuParseCommandLine on OOM
Daniel P. Berrange
berrange at redhat.com
Tue Sep 24 16:04:02 UTC 2013
From: "Daniel P. Berrange" <berrange at redhat.com>
If the call to virDomainControllerInsert fails in
qemuParseCommandLine, the controller struct is leaked.
Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
---
src/qemu/qemu_command.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 7029335..a8b9a74 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -11630,8 +11630,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)
--
1.8.3.1
More information about the libvir-list
mailing list