From 94e6b94ab7f0205df285cfcf5a541575caf08a09 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Tue, 24 Sep 2013 16:37:24 +0100 Subject: [PATCH] Fix leak in qemuParseCommandLine on OOM If the call to virDomainControllerInsert fails in qemuParseCommandLine, the controller struct is leaked. Signed-off-by: Daniel P. Berrange --- 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 4b4f9c92b0..1f9a999760 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -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) -- 2.47.2