mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-24 12:22:20 +00:00
cpu_x86: Use glib allocation in virCPUx86GetModels
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
247e115e27
commit
e43e2ff7f5
@ -3121,21 +3121,13 @@ virCPUx86GetModels(char ***models)
|
||||
return -1;
|
||||
|
||||
if (models) {
|
||||
if (VIR_ALLOC_N(*models, map->nmodels + 1) < 0)
|
||||
goto error;
|
||||
*models = g_new0(char *, map->nmodels + 1);
|
||||
|
||||
for (i = 0; i < map->nmodels; i++)
|
||||
(*models)[i] = g_strdup(map->models[i]->name);
|
||||
}
|
||||
|
||||
return map->nmodels;
|
||||
|
||||
error:
|
||||
if (models) {
|
||||
virStringListFree(*models);
|
||||
*models = NULL;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user