From 181a945fd8f715100fd559721dbbe8ca2704d0ae Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A1n=20Tomko?= Date: Sat, 22 Feb 2020 00:55:50 +0100 Subject: [PATCH] qemumonitorjsontest: GetCPUModelBaseline: use g_auto MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Use g_autoptr for the virCPUDef variables. Signed-off-by: Ján Tomko Reviewed-by: Michal Privoznik --- tests/qemumonitorjsontest.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) 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; } -- 2.47.2