From: Kirill Shchetiniuk <[email protected]>

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

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index d41dd4a829..1d983a636f 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9640,20 +9640,16 @@ virDomainNetAppendIPAddress(virDomainNetDef *def,
                             int family,
                             unsigned int prefix)
 {
-    virNetDevIPAddr *ipDef = NULL;
+    g_autofree virNetDevIPAddr *ipDef = NULL;
     ipDef = g_new0(virNetDevIPAddr, 1);
 
     if (virSocketAddrParse(&ipDef->address, address, family) < 0)
-        goto error;
+        return -1;
     ipDef->prefix = prefix;
 
     VIR_APPEND_ELEMENT(def->guestIP.ips, def->guestIP.nips, ipDef);
 
     return 0;
-
- error:
-    VIR_FREE(ipDef);
-    return -1;
 }
 
 
-- 
2.49.0

Reply via email to