[libvirt PATCH 4/7] qemumonitorjsontest: use virCPUDefNew()

Ján Tomko jtomko at redhat.com
Sat Feb 22 00:24:09 UTC 2020


virCPUDefPtr uses refcounting internally and must be allocated
using virCPUDefNew, otherwise virCPUDefFree would be a no-op.

Signed-off-by: Ján Tomko <jtomko at redhat.com>
Fixes: fa2404bf4f91813431beb797fc30a1237a743823
Fixes: eee09435eec46553aac4fdf1c2d8f3214167bded
---
 tests/qemumonitorjsontest.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 40fc40bddd..1a090b0cb5 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -2997,8 +2997,8 @@ testQemuMonitorJSONqemuMonitorJSONGetCPUModelComparison(const void *opaque)
                                "{\"return\":{\"result\":\"test\"}}") < 0)
         return -1;
 
-    if (VIR_ALLOC(cpu_a) < 0 || VIR_ALLOC(cpu_b) < 0)
-        goto cleanup;
+    cpu_a = virCPUDefNew();
+    cpu_b = virCPUDefNew();
 
     cpu_a->model = g_strdup("cpu_a");
     cpu_b->model = g_strdup("cpu_b");
@@ -3049,8 +3049,8 @@ testQemuMonitorJSONqemuMonitorJSONGetCPUModelBaseline(const void *opaque)
                                "}") < 0)
         return -1;
 
-    if (VIR_ALLOC(cpu_a) < 0 || VIR_ALLOC(cpu_b) < 0)
-        goto cleanup;
+    cpu_a = virCPUDefNew();
+    cpu_b = virCPUDefNew();
 
     cpu_a->model = g_strdup("cpu_a");
     cpu_b->model = g_strdup("cpu_b");
-- 
2.24.1




More information about the libvir-list mailing list