From: Kirill Shchetiniuk <[email protected]>

Signed-off-by: Kirill Shchetiniuk <[email protected]>
---
 src/conf/domain_conf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1d983a636f..01a9b070f6 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -10949,16 +10949,16 @@ virDomainChrSourceDefNew(virDomainXMLOption *xmlopt)
 virDomainChrDef *
 virDomainChrDefNew(virDomainXMLOption *xmlopt)
 {
-    virDomainChrDef *def = NULL;
+    g_autoptr(virDomainChrDef) def = NULL;
 
     def = g_new0(virDomainChrDef, 1);
 
     def->target.port = -1;
 
     if (!(def->source = virDomainChrSourceDefNew(xmlopt)))
-        VIR_FREE(def);
+        return NULL;
 
-    return def;
+    return g_steal_pointer(&def);
 }
 
 /* Parse the XML definition for a character device
-- 
2.49.0

Reply via email to