[libvirt PATCH v2 6/7] util: Use glib memory functions in virJSONValueGetArrayAsBitmap

Tim Wiederhake twiederh at redhat.com
Mon Sep 14 08:01:53 UTC 2020


Signed-off-by: Tim Wiederhake <twiederh at redhat.com>
---
 src/util/virjson.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/util/virjson.c b/src/util/virjson.c
index 6921eccb60..ba43d6b667 100644
--- a/src/util/virjson.c
+++ b/src/util/virjson.c
@@ -1243,8 +1243,7 @@ virJSONValueGetArrayAsBitmap(const virJSONValue *val,
     if (val->type != VIR_JSON_TYPE_ARRAY)
         return -1;
 
-    if (VIR_ALLOC_N_QUIET(elems, val->data.array.nvalues) < 0)
-        return -1;
+    elems = g_new0(unsigned long long, val->data.array.nvalues);
 
     /* first pass converts array members to numbers and finds the maximum */
     for (i = 0; i < val->data.array.nvalues; i++) {
-- 
2.26.2




More information about the libvir-list mailing list