mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 23:07:44 +00:00
qemuBuildControllersByTypeCommandLine: free devstr in the cleanup
section Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
c7e03df8c0
commit
fc1c16bccd
@ -3145,12 +3145,12 @@ qemuBuildControllersByTypeCommandLine(virCommandPtr cmd,
|
||||
virQEMUCapsPtr qemuCaps,
|
||||
virDomainControllerType type)
|
||||
{
|
||||
char *devstr = NULL;
|
||||
int ret = -1;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < def->ncontrollers; i++) {
|
||||
virDomainControllerDefPtr cont = def->controllers[i];
|
||||
char *devstr;
|
||||
|
||||
if (cont->type != type)
|
||||
continue;
|
||||
@ -3183,23 +3183,22 @@ qemuBuildControllersByTypeCommandLine(virCommandPtr cmd,
|
||||
continue;
|
||||
}
|
||||
|
||||
VIR_FREE(devstr);
|
||||
if (qemuBuildControllerDevStr(def, cont, qemuCaps, &devstr) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (devstr) {
|
||||
if (qemuCommandAddExtDevice(cmd, &cont->info) < 0) {
|
||||
VIR_FREE(devstr);
|
||||
if (qemuCommandAddExtDevice(cmd, &cont->info) < 0)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
virCommandAddArg(cmd, "-device");
|
||||
virCommandAddArg(cmd, devstr);
|
||||
VIR_FREE(devstr);
|
||||
}
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
VIR_FREE(devstr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user