From: Ján Tomko Date: Sat, 22 Feb 2020 00:06:51 +0000 (+0100) Subject: qemumonitorjsontest: use virCPUDefNew() X-Git-Tag: v6.2.0-rc1~250 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9aa2426795f0cda8976400325a80d59180baa2b3;p=thirdparty%2Flibvirt.git qemumonitorjsontest: use virCPUDefNew() virCPUDefPtr uses refcounting internally and must be allocated using virCPUDefNew, otherwise virCPUDefFree would be a no-op. Signed-off-by: Ján Tomko Fixes: fa2404bf4f91813431beb797fc30a1237a743823 Fixes: eee09435eec46553aac4fdf1c2d8f3214167bded Reviewed-by: Michal Privoznik --- diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 9451c5de5b..70ebdfd2d4 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -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");