From 3850add603c8f44d0ebde5a53f87809b8fbe3907 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Wed, 22 Apr 2020 16:16:19 +0200 Subject: [PATCH] qemuDomainSaveImageOpen: Use g_autoptr for 'def' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- src/qemu/qemu_driver.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 5b87aaf9c2..57c66c3401 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6695,7 +6695,7 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver, int ret = -1; g_autoptr(virQEMUSaveData) data = NULL; virQEMUSaveHeaderPtr header; - virDomainDefPtr def = NULL; + g_autoptr(virDomainDef) def = NULL; int oflags = open_write ? O_RDWR : O_RDONLY; size_t xml_len; size_t cookie_len; @@ -6809,13 +6809,12 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver, VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE))) goto error; - *ret_def = def; + *ret_def = g_steal_pointer(&def); *ret_data = g_steal_pointer(&data); return fd; error: - virDomainDefFree(def); VIR_FORCE_CLOSE(fd); return ret; }