From: Jiri Denemark Date: Wed, 25 Mar 2020 17:41:48 +0000 (+0100) Subject: cpu_x86: Use glib allocation in virCPUx86GetModels X-Git-Tag: v6.3.0-rc1~201 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e43e2ff7f5b629f979e56387c4be46f2be251b75;p=thirdparty%2Flibvirt.git cpu_x86: Use glib allocation in virCPUx86GetModels Signed-off-by: Jiri Denemark Reviewed-by: Ján Tomko --- diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 51c2a0ea36..3c08edcd73 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -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; }