Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/cpu/cpu_ppc64.c | 4 +++-
src/cpu/cpu_x86.c | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c
index 364c8ed..1aed984 100644
--- a/src/cpu/cpu_ppc64.c
+++ b/src/cpu/cpu_ppc64.c
@@ -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++;
}
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index b7f1690..c6aacc1 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -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++;
}
--
2.8.2