mirror of
https://github.com/libvirt/libvirt.git
synced 2026-09-03 20:53:04 -05: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:
@@ -3145,12 +3145,12 @@ qemuBuildControllersByTypeCommandLine(virCommandPtr cmd,
|
|||||||
virQEMUCapsPtr qemuCaps,
|
virQEMUCapsPtr qemuCaps,
|
||||||
virDomainControllerType type)
|
virDomainControllerType type)
|
||||||
{
|
{
|
||||||
|
char *devstr = NULL;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
for (i = 0; i < def->ncontrollers; i++) {
|
for (i = 0; i < def->ncontrollers; i++) {
|
||||||
virDomainControllerDefPtr cont = def->controllers[i];
|
virDomainControllerDefPtr cont = def->controllers[i];
|
||||||
char *devstr;
|
|
||||||
|
|
||||||
if (cont->type != type)
|
if (cont->type != type)
|
||||||
continue;
|
continue;
|
||||||
@@ -3183,23 +3183,22 @@ qemuBuildControllersByTypeCommandLine(virCommandPtr cmd,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VIR_FREE(devstr);
|
||||||
if (qemuBuildControllerDevStr(def, cont, qemuCaps, &devstr) < 0)
|
if (qemuBuildControllerDevStr(def, cont, qemuCaps, &devstr) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (devstr) {
|
if (devstr) {
|
||||||
if (qemuCommandAddExtDevice(cmd, &cont->info) < 0) {
|
if (qemuCommandAddExtDevice(cmd, &cont->info) < 0)
|
||||||
VIR_FREE(devstr);
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
virCommandAddArg(cmd, "-device");
|
virCommandAddArg(cmd, "-device");
|
||||||
virCommandAddArg(cmd, devstr);
|
virCommandAddArg(cmd, devstr);
|
||||||
VIR_FREE(devstr);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
cleanup:
|
cleanup:
|
||||||
|
VIR_FREE(devstr);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user