On a Friday in 2020, Jiri Denemark wrote:
Signed-off-by: Jiri Denemark <jdene...@redhat.com>
---
src/cpu/cpu_x86.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index bcb87d6f93..fce7a2b8c5 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -3123,21 +3123,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:

Bye, error:

-    if (models) {
-        virStringListFree(*models);
-        *models = NULL;
-    }
-    return -1;
}

Reviewed-by: Ján Tomko <jto...@redhat.com>

Jano

Attachment: signature.asc
Description: PGP signature

Reply via email to