[PATCH 3/3] conf: use g_free() instead of VIR_FREE in virDomainNetDefFree()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



All these lines were moved over from the now-defunct
virDomainNetDefClear(), which required all pointers to be cleared
after free, but virDomainNetDefFree() doesn't have that restriction -
after free'ing the pointers are never again referenced, so g_free() is
safe.

Signed-off-by: Laine Stump <laine@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 42 +++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index df5171301d..7292dceb6b 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2509,27 +2509,27 @@ virDomainNetDefFree(virDomainNetDefPtr def)
     case VIR_DOMAIN_NET_TYPE_CLIENT:
     case VIR_DOMAIN_NET_TYPE_MCAST:
     case VIR_DOMAIN_NET_TYPE_UDP:
-        VIR_FREE(def->data.socket.address);
-        VIR_FREE(def->data.socket.localaddr);
+        g_free(def->data.socket.address);
+        g_free(def->data.socket.localaddr);
         break;
 
     case VIR_DOMAIN_NET_TYPE_NETWORK:
-        VIR_FREE(def->data.network.name);
-        VIR_FREE(def->data.network.portgroup);
+        g_free(def->data.network.name);
+        g_free(def->data.network.portgroup);
         virDomainActualNetDefFree(def->data.network.actual);
         def->data.network.actual = NULL;
         break;
 
     case VIR_DOMAIN_NET_TYPE_BRIDGE:
-        VIR_FREE(def->data.bridge.brname);
+        g_free(def->data.bridge.brname);
         break;
 
     case VIR_DOMAIN_NET_TYPE_INTERNAL:
-        VIR_FREE(def->data.internal.name);
+        g_free(def->data.internal.name);
         break;
 
     case VIR_DOMAIN_NET_TYPE_DIRECT:
-        VIR_FREE(def->data.direct.linkdev);
+        g_free(def->data.direct.linkdev);
         break;
 
     case VIR_DOMAIN_NET_TYPE_HOSTDEV:
@@ -2542,24 +2542,24 @@ virDomainNetDefFree(virDomainNetDefPtr def)
         break;
     }
 
-    VIR_FREE(def->backend.tap);
-    VIR_FREE(def->backend.vhost);
-    VIR_FREE(def->teaming.persistent);
-    VIR_FREE(def->virtPortProfile);
-    VIR_FREE(def->script);
-    VIR_FREE(def->downscript);
-    VIR_FREE(def->domain_name);
-    VIR_FREE(def->ifname);
-    VIR_FREE(def->ifname_guest);
-    VIR_FREE(def->ifname_guest_actual);
-    VIR_FREE(def->virtio);
-    VIR_FREE(def->coalesce);
+    g_free(def->backend.tap);
+    g_free(def->backend.vhost);
+    g_free(def->teaming.persistent);
+    g_free(def->virtPortProfile);
+    g_free(def->script);
+    g_free(def->downscript);
+    g_free(def->domain_name);
+    g_free(def->ifname);
+    g_free(def->ifname_guest);
+    g_free(def->ifname_guest_actual);
+    g_free(def->virtio);
+    g_free(def->coalesce);
 
     virNetDevIPInfoClear(&def->guestIP);
     virNetDevIPInfoClear(&def->hostIP);
     virDomainDeviceInfoClear(&def->info);
 
-    VIR_FREE(def->filter);
+    g_free(def->filter);
     virHashFree(def->filterparams);
     def->filterparams = NULL;
 
@@ -2568,7 +2568,7 @@ virDomainNetDefFree(virDomainNetDefPtr def)
     virNetDevVlanClear(&def->vlan);
 
     virObjectUnref(def->privateData);
-    VIR_FREE(def);
+    g_free(def);
 }
 
 
-- 
2.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux