From: Kirill Shchetiniuk <[email protected]>

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

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 14fb82e296..0b36a71dba 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -3435,18 +3435,17 @@ void virDomainShmemDefFree(virDomainShmemDef *def)
 virDomainVideoDef *
 virDomainVideoDefNew(virDomainXMLOption *xmlopt)
 {
-    virDomainVideoDef *def;
+    g_autoptr(virDomainVideoDef) def = NULL;
 
     def = g_new0(virDomainVideoDef, 1);
 
     if (xmlopt && xmlopt->privateData.videoNew &&
         !(def->privateData = xmlopt->privateData.videoNew())) {
-        VIR_FREE(def);
         return NULL;
     }
 
     def->heads = 1;
-    return def;
+    return g_steal_pointer(&def);
 }
 
 
-- 
2.49.0

Reply via email to