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 <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrange 2013-09-24 16:37:24 +01:00
parent b391b19144
commit 94e6b94ab7

View 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)