Re: [libvirt PATCH 07/39] cpu_x86: Use glib allocation in virCPUx86GetModels

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On a Friday in 2020, Jiri Denemark wrote:
Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
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 <jtomko@xxxxxxxxxx>

Jano

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux