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

cpu_x86: Use glib allocation in virCPUx86GetModels

Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 247e115e
...@@ -3121,21 +3121,13 @@ virCPUx86GetModels(char ***models) ...@@ -3121,21 +3121,13 @@ virCPUx86GetModels(char ***models)
return -1; return -1;
if (models) { if (models) {
if (VIR_ALLOC_N(*models, map->nmodels + 1) < 0) *models = g_new0(char *, map->nmodels + 1);
goto error;
for (i = 0; i < map->nmodels; i++) for (i = 0; i < map->nmodels; i++)
(*models)[i] = g_strdup(map->models[i]->name); (*models)[i] = g_strdup(map->models[i]->name);
} }
return map->nmodels; return map->nmodels;
error:
if (models) {
virStringListFree(*models);
*models = NULL;
}
return -1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册