From: Ján Tomko Date: Fri, 21 Feb 2020 23:55:50 +0000 (+0100) Subject: qemumonitorjsontest: GetCPUModelBaseline: use g_auto X-Git-Tag: v6.2.0-rc1~247 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=181a945fd8f715100fd559721dbbe8ca2704d0ae;p=thirdparty%2Flibvirt.git qemumonitorjsontest: GetCPUModelBaseline: use g_auto Use g_autoptr for the virCPUDef variables. Signed-off-by: Ján Tomko Reviewed-by: Michal Privoznik --- diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index a5d980c8b3..0a6760a794 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -3014,8 +3014,8 @@ testQemuMonitorJSONqemuMonitorJSONGetCPUModelBaseline(const void *opaque) { const testGenericData *data = opaque; g_autoptr(qemuMonitorTest) test = NULL; - virCPUDefPtr cpu_a; - virCPUDefPtr cpu_b = NULL; + g_autoptr(virCPUDef) cpu_a = virCPUDefNew(); + g_autoptr(virCPUDef) cpu_b = virCPUDefNew(); qemuMonitorCPUModelInfoPtr baseline = NULL; int ret = -1; @@ -3036,9 +3036,6 @@ testQemuMonitorJSONqemuMonitorJSONGetCPUModelBaseline(const void *opaque) "}") < 0) return -1; - cpu_a = virCPUDefNew(); - cpu_b = virCPUDefNew(); - cpu_a->model = g_strdup("cpu_a"); cpu_b->model = g_strdup("cpu_b"); @@ -3078,8 +3075,6 @@ testQemuMonitorJSONqemuMonitorJSONGetCPUModelBaseline(const void *opaque) ret = 0; cleanup: - virCPUDefFree(cpu_a); - virCPUDefFree(cpu_b); qemuMonitorCPUModelInfoFree(baseline); return ret; }