From: Daniel P. Berrange Date: Tue, 24 Sep 2013 15:37:24 +0000 (+0100) Subject: Fix leak in qemuParseCommandLine on OOM X-Git-Tag: v1.1.3-rc1~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=94e6b94ab7f0205df285cfcf5a541575caf08a09;p=thirdparty%2Flibvirt.git 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 --- 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)