mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 03:12:22 +00:00
qemuBuildControllersByTypeCommandLine: use VIR_AUTOFREE
Reduce the scope of the variable to get it freed for every controller processed. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
f4bc171676
commit
5253def175
@ -3191,12 +3191,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];
|
||||
VIR_AUTOFREE(char *) devstr = NULL;
|
||||
|
||||
if (cont->type != type)
|
||||
continue;
|
||||
@ -3229,7 +3229,6 @@ qemuBuildControllersByTypeCommandLine(virCommandPtr cmd,
|
||||
continue;
|
||||
}
|
||||
|
||||
VIR_FREE(devstr);
|
||||
if (qemuBuildControllerDevStr(def, cont, qemuCaps, &devstr) < 0)
|
||||
goto cleanup;
|
||||
|
||||
@ -3244,7 +3243,6 @@ qemuBuildControllersByTypeCommandLine(virCommandPtr cmd,
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
VIR_FREE(devstr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user