]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemumonitorjsontest: use virCPUDefNew()
authorJán Tomko <jtomko@redhat.com>
Sat, 22 Feb 2020 00:06:51 +0000 (01:06 +0100)
committerJán Tomko <jtomko@redhat.com>
Mon, 9 Mar 2020 14:46:43 +0000 (15:46 +0100)
virCPUDefPtr uses refcounting internally and must be allocated
using virCPUDefNew, otherwise virCPUDefFree would be a no-op.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: fa2404bf4f91813431beb797fc30a1237a743823
Fixes: eee09435eec46553aac4fdf1c2d8f3214167bded
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
tests/qemumonitorjsontest.c

index 9451c5de5b5be12717a91d1b692364e57fbbb5e3..70ebdfd2d43adbe27e9791ba79aecd63751ef1e3 100644 (file)
@@ -2993,8 +2993,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");
@@ -3045,8 +3045,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");