提交 afdb3fc9 编写于 作者: J Jiri Denemark

cpuGetModels: Fix memory leak on error

Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
上级 2b140f0c
......@@ -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++;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册