mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
cpuGetModels: Fix memory leak on error
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
2b140f0cae
commit
afdb3fc901
@ -886,8 +886,10 @@ ppc64DriverGetModels(char ***models)
|
||||
if (VIR_STRDUP(name, model->name) < 0)
|
||||
goto error;
|
||||
|
||||
if (VIR_APPEND_ELEMENT(*models, nmodels, name) < 0)
|
||||
if (VIR_APPEND_ELEMENT(*models, nmodels, name) < 0) {
|
||||
VIR_FREE(name);
|
||||
goto error;
|
||||
}
|
||||
} else {
|
||||
nmodels++;
|
||||
}
|
||||
|
@ -2219,8 +2219,10 @@ x86GetModels(char ***models)
|
||||
if (VIR_STRDUP(name, model->name) < 0)
|
||||
goto error;
|
||||
|
||||
if (VIR_APPEND_ELEMENT(*models, nmodels, name) < 0)
|
||||
if (VIR_APPEND_ELEMENT(*models, nmodels, name) < 0) {
|
||||
VIR_FREE(name);
|
||||
goto error;
|
||||
}
|
||||
} else {
|
||||
nmodels++;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user