[PATCH 8/8] conf: replace VIR_FREE() with g_free() in vir*Free() functions

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

 



This patch takes on one set of examples of unnecessary use of
VIR_FREE() when g_free() is adequate - it modifies only vir*Free()
functions within the conf directory that take a single pointer and
free the object pointed to by that argument before returning. The
modification is to replace VIR_FREE() with g_free() for the object
itself *and* for all subordinate chunks of memory pointed to by that
object.

(NB: there are other functions that VIR_FREE subordinate memory of
objects that end up being freed before return (also sometimes with
VIR_FREE); I am purposefully ignoring those to reduce scope and focus
on a sub class where the pointlessness is obvious.)

Signed-off-by: Laine Stump <laine@xxxxxxxxxx>
---

NB: After going through the experience a few days ago of needing to
more or less manually backport a patch due to a different patch
similar to this one touching the one function relevant to the desired
patch as well as many dozens of other functions (thus making it
impractical to backport that patch as a prerequisite), I contemplated
splitting this patch up all the way to 1 patch for every
function. That seemed extreme though, so I've left it as is. An
alternative, of course, is to just do nothing and leave everything as
VIR_FREE() (and I know there is sentiment in that direction, a bit
from me even :-P). I wonder though if we'll ever live up to the goals
listed in docs/glib-adoption.txt...



 src/conf/capabilities.c               |   8 +-
 src/conf/cpu_conf.c                   |   8 +-
 src/conf/device_conf.c                |   2 +-
 src/conf/domain_addr.c                |  22 +-
 src/conf/domain_capabilities.c        |   6 +-
 src/conf/domain_conf.c                | 298 +++++++++++++-------------
 src/conf/interface_conf.c             |  32 +--
 src/conf/network_conf.c               |  18 +-
 src/conf/node_device_conf.c           | 104 ++++-----
 src/conf/nwfilter_conf.c              |  22 +-
 src/conf/nwfilter_params.c            |  16 +-
 src/conf/object_event.c               |  12 +-
 src/conf/secret_conf.c                |   6 +-
 src/conf/snapshot_conf.c              |   2 +-
 src/conf/storage_conf.c               |  22 +-
 src/conf/storage_encryption_conf.c    |   4 +-
 src/conf/storage_source_conf.c        |  26 +--
 src/conf/virdomaincheckpointobjlist.c |   2 +-
 src/conf/virdomainmomentobjlist.c     |   4 +-
 src/conf/virdomainsnapshotobjlist.c   |   2 +-
 src/conf/virnetworkportdef.c          |  12 +-
 src/conf/virnwfilterbindingdef.c      |  10 +-
 src/conf/virnwfilterobj.c             |   6 +-
 23 files changed, 322 insertions(+), 322 deletions(-)

diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index 425f34113a..954cdd2c8c 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c
@@ -207,7 +207,7 @@ virCapsHostMemBWNodeFree(virCapsHostMemBWNodePtr ptr)
         return;
 
     virBitmapFree(ptr->cpus);
-    VIR_FREE(ptr);
+    g_free(ptr);
 }
 
 static void
@@ -1757,9 +1757,9 @@ virCapsHostCacheBankFree(virCapsHostCacheBankPtr ptr)
 
     virBitmapFree(ptr->cpus);
     for (i = 0; i < ptr->ncontrols; i++)
-        VIR_FREE(ptr->controls[i]);
-    VIR_FREE(ptr->controls);
-    VIR_FREE(ptr);
+        g_free(ptr->controls[i]);
+    g_free(ptr->controls);
+    g_free(ptr);
 }
 
 
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index a2d88ba818..f98b0a0eb3 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -127,9 +127,9 @@ virCPUDefFree(virCPUDefPtr def)
 
     if (g_atomic_int_dec_and_test(&def->refs)) {
         virCPUDefFreeModel(def);
-        VIR_FREE(def->cache);
-        VIR_FREE(def->tsc);
-        VIR_FREE(def);
+        g_free(def->cache);
+        g_free(def->tsc);
+        g_free(def);
     }
 }
 
@@ -1199,5 +1199,5 @@ virCPUDefListFree(virCPUDefPtr *cpus)
     for (cpu = cpus; *cpu != NULL; cpu++)
         virCPUDefFree(*cpu);
 
-    VIR_FREE(cpus);
+    g_free(cpus);
 }
diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c
index 87bf32bbc6..714ac50762 100644
--- a/src/conf/device_conf.c
+++ b/src/conf/device_conf.c
@@ -99,7 +99,7 @@ virDomainDeviceInfoFree(virDomainDeviceInfoPtr info)
 {
     if (info) {
         virDomainDeviceInfoClear(info);
-        VIR_FREE(info);
+        g_free(info);
     }
 }
 
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index 4ba620086d..bbfee6918e 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -952,7 +952,7 @@ virDomainPCIAddressSetExtensionFree(virDomainZPCIAddressIdsPtr zpciIds)
     virHashFree(zpciIds->uids);
     virHashFree(zpciIds->fids);
 
-    VIR_FREE(zpciIds);
+    g_free(zpciIds);
 }
 
 
@@ -1002,8 +1002,8 @@ virDomainPCIAddressSetFree(virDomainPCIAddressSetPtr addrs)
         return;
 
     virDomainPCIAddressSetExtensionFree(addrs->zpciIds);
-    VIR_FREE(addrs->buses);
-    VIR_FREE(addrs);
+    g_free(addrs->buses);
+    g_free(addrs);
 }
 
 
@@ -1379,7 +1379,7 @@ void virDomainCCWAddressSetFree(virDomainCCWAddressSetPtr addrs)
         return;
 
     virHashFree(addrs->defined);
-    VIR_FREE(addrs);
+    g_free(addrs);
 }
 
 static virDomainCCWAddressSetPtr
@@ -1451,7 +1451,7 @@ virDomainVirtioSerialControllerFree(virDomainVirtioSerialControllerPtr cont)
 {
     if (cont) {
         virBitmapFree(cont->ports);
-        VIR_FREE(cont);
+        g_free(cont);
     }
 }
 
@@ -1558,8 +1558,8 @@ virDomainVirtioSerialAddrSetFree(virDomainVirtioSerialAddrSetPtr addrs)
     if (addrs) {
         for (i = 0; i < addrs->ncontrollers; i++)
             virDomainVirtioSerialControllerFree(addrs->controllers[i]);
-        VIR_FREE(addrs->controllers);
-        VIR_FREE(addrs);
+        g_free(addrs->controllers);
+        g_free(addrs);
     }
 }
 
@@ -1886,9 +1886,9 @@ virDomainUSBAddressHubFree(virDomainUSBAddressHubPtr hub)
 
     for (i = 0; i < hub->nports; i++)
         virDomainUSBAddressHubFree(hub->ports[i]);
-    VIR_FREE(hub->ports);
+    g_free(hub->ports);
     virBitmapFree(hub->portmap);
-    VIR_FREE(hub);
+    g_free(hub);
 }
 
 
@@ -1902,8 +1902,8 @@ virDomainUSBAddressSetFree(virDomainUSBAddressSetPtr addrs)
 
     for (i = 0; i < addrs->nbuses; i++)
         virDomainUSBAddressHubFree(addrs->buses[i]);
-    VIR_FREE(addrs->buses);
-    VIR_FREE(addrs);
+    g_free(addrs->buses);
+    g_free(addrs);
 }
 
 
diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c
index 8130311590..08789aeb31 100644
--- a/src/conf/domain_capabilities.c
+++ b/src/conf/domain_capabilities.c
@@ -85,9 +85,9 @@ virSEVCapabilitiesFree(virSEVCapability *cap)
     if (!cap)
         return;
 
-    VIR_FREE(cap->pdh);
-    VIR_FREE(cap->cert_chain);
-    VIR_FREE(cap);
+    g_free(cap->pdh);
+    g_free(cap->cert_chain);
+    g_free(cap);
 }
 
 
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1a163857ca..97fa841bff 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1806,30 +1806,30 @@ void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def)
 
     switch (def->type) {
     case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
-        VIR_FREE(def->data.vnc.keymap);
+        g_free(def->data.vnc.keymap);
         virDomainGraphicsAuthDefClear(&def->data.vnc.auth);
         break;
 
     case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
-        VIR_FREE(def->data.sdl.display);
-        VIR_FREE(def->data.sdl.xauth);
+        g_free(def->data.sdl.display);
+        g_free(def->data.sdl.xauth);
         break;
 
     case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
         break;
 
     case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
-        VIR_FREE(def->data.desktop.display);
+        g_free(def->data.desktop.display);
         break;
 
     case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
-        VIR_FREE(def->data.spice.rendernode);
-        VIR_FREE(def->data.spice.keymap);
+        g_free(def->data.spice.rendernode);
+        g_free(def->data.spice.keymap);
         virDomainGraphicsAuthDefClear(&def->data.spice.auth);
         break;
 
     case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
-        VIR_FREE(def->data.egl_headless.rendernode);
+        g_free(def->data.egl_headless.rendernode);
         break;
 
     case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
@@ -1838,10 +1838,10 @@ void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def)
 
     for (i = 0; i < def->nListens; i++)
         virDomainGraphicsListenDefClear(&def->listens[i]);
-    VIR_FREE(def->listens);
+    g_free(def->listens);
 
     virObjectUnref(def->privateData);
-    VIR_FREE(def);
+    g_free(def);
 }
 
 const char *virDomainInputDefGetPath(virDomainInputDefPtr input)
@@ -1865,9 +1865,9 @@ void virDomainInputDefFree(virDomainInputDefPtr def)
         return;
 
     virDomainDeviceInfoClear(&def->info);
-    VIR_FREE(def->source.evdev);
-    VIR_FREE(def->virtio);
-    VIR_FREE(def);
+    g_free(def->source.evdev);
+    g_free(def->virtio);
+    g_free(def);
 }
 
 void virDomainLeaseDefFree(virDomainLeaseDefPtr def)
@@ -1875,11 +1875,11 @@ void virDomainLeaseDefFree(virDomainLeaseDefPtr def)
     if (!def)
         return;
 
-    VIR_FREE(def->lockspace);
-    VIR_FREE(def->key);
-    VIR_FREE(def->path);
+    g_free(def->lockspace);
+    g_free(def->key);
+    g_free(def->path);
 
-    VIR_FREE(def);
+    g_free(def);
 }
 
 
@@ -1909,7 +1909,7 @@ virDomainVcpuDefFree(virDomainVcpuDefPtr info)
 
     virBitmapFree(info->cpumask);
     virObjectUnref(info->privateData);
-    VIR_FREE(info);
+    g_free(info);
 }
 
 
@@ -2184,20 +2184,20 @@ virDomainDiskDefFree(virDomainDiskDefPtr def)
         return;
 
     virObjectUnref(def->src);
-    VIR_FREE(def->serial);
-    VIR_FREE(def->dst);
+    g_free(def->serial);
+    g_free(def->dst);
     virObjectUnref(def->mirror);
-    VIR_FREE(def->wwn);
-    VIR_FREE(def->driverName);
-    VIR_FREE(def->vendor);
-    VIR_FREE(def->product);
-    VIR_FREE(def->domain_name);
-    VIR_FREE(def->blkdeviotune.group_name);
-    VIR_FREE(def->virtio);
+    g_free(def->wwn);
+    g_free(def->driverName);
+    g_free(def->vendor);
+    g_free(def->product);
+    g_free(def->domain_name);
+    g_free(def->blkdeviotune.group_name);
+    g_free(def->virtio);
     virDomainDeviceInfoClear(&def->info);
     virObjectUnref(def->privateData);
 
-    VIR_FREE(def);
+    g_free(def);
 }
 
 
@@ -2327,9 +2327,9 @@ void virDomainControllerDefFree(virDomainControllerDefPtr def)
         return;
 
     virDomainDeviceInfoClear(&def->info);
-    VIR_FREE(def->virtio);
+    g_free(def->virtio);
 
-    VIR_FREE(def);
+    g_free(def);
 }
 
 
@@ -2391,13 +2391,13 @@ void virDomainFSDefFree(virDomainFSDefPtr def)
         return;
 
     virObjectUnref(def->src);
-    VIR_FREE(def->dst);
+    g_free(def->dst);
     virDomainDeviceInfoClear(&def->info);
-    VIR_FREE(def->virtio);
+    g_free(def->virtio);
     virObjectUnref(def->privateData);
-    VIR_FREE(def->binary);
+    g_free(def->binary);
 
-    VIR_FREE(def);
+    g_free(def);
 }
 
 void
@@ -2409,10 +2409,10 @@ virDomainActualNetDefFree(virDomainActualNetDefPtr def)
     switch (def->type) {
     case VIR_DOMAIN_NET_TYPE_BRIDGE:
     case VIR_DOMAIN_NET_TYPE_NETWORK:
-        VIR_FREE(def->data.bridge.brname);
+        g_free(def->data.bridge.brname);
         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:
         virDomainHostdevDefClear(&def->data.hostdev.def);
@@ -2421,10 +2421,10 @@ virDomainActualNetDefFree(virDomainActualNetDefPtr def)
         break;
     }
 
-    VIR_FREE(def->virtPortProfile);
+    g_free(def->virtPortProfile);
     virNetDevBandwidthFree(def->bandwidth);
     virNetDevVlanClear(&def->vlan);
-    VIR_FREE(def);
+    g_free(def);
 }
 
 
@@ -2456,8 +2456,8 @@ virDomainVsockDefFree(virDomainVsockDefPtr vsock)
 
     virObjectUnref(vsock->privateData);
     virDomainDeviceInfoClear(&vsock->info);
-    VIR_FREE(vsock->virtio);
-    VIR_FREE(vsock);
+    g_free(vsock->virtio);
+    g_free(vsock);
 }
 
 
@@ -2467,7 +2467,7 @@ virDomainNetDefFree(virDomainNetDefPtr def)
     if (!def)
         return;
 
-    VIR_FREE(def->modelstr);
+    g_free(def->modelstr);
 
     switch (def->type) {
     case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
@@ -2475,7 +2475,7 @@ virDomainNetDefFree(virDomainNetDefPtr def)
         break;
 
     case VIR_DOMAIN_NET_TYPE_VDPA:
-        VIR_FREE(def->data.vdpa.devicepath);
+        g_free(def->data.vdpa.devicepath);
         break;
 
     case VIR_DOMAIN_NET_TYPE_SERVER:
@@ -2764,12 +2764,12 @@ void virDomainChrDefFree(virDomainChrDefPtr def)
     case VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL:
         switch (def->targetType) {
         case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD:
-            VIR_FREE(def->target.addr);
+            g_free(def->target.addr);
             break;
 
         case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_XEN:
         case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO:
-            VIR_FREE(def->target.name);
+            g_free(def->target.name);
             break;
         }
         break;
@@ -2781,7 +2781,7 @@ void virDomainChrDefFree(virDomainChrDefPtr def)
     virObjectUnref(def->source);
     virDomainDeviceInfoClear(&def->info);
 
-    VIR_FREE(def);
+    g_free(def);
 }
 
 void virDomainSmartcardDefFree(virDomainSmartcardDefPtr def)
@@ -2796,8 +2796,8 @@ void virDomainSmartcardDefFree(virDomainSmartcardDefPtr def)
 
     case VIR_DOMAIN_SMARTCARD_TYPE_HOST_CERTIFICATES:
         for (i = 0; i < VIR_DOMAIN_SMARTCARD_NUM_CERTIFICATES; i++)
-            VIR_FREE(def->data.cert.file[i]);
-        VIR_FREE(def->data.cert.database);
+            g_free(def->data.cert.file[i]);
+        g_free(def->data.cert.database);
         break;
 
     case VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH:
@@ -2810,7 +2810,7 @@ void virDomainSmartcardDefFree(virDomainSmartcardDefPtr def)
 
     virDomainDeviceInfoClear(&def->info);
 
-    VIR_FREE(def);
+    g_free(def);
 }
 
 void virDomainSoundCodecDefFree(virDomainSoundCodecDefPtr def)
@@ -2818,7 +2818,7 @@ void virDomainSoundCodecDefFree(virDomainSoundCodecDefPtr def)
     if (!def)
         return;
 
-    VIR_FREE(def);
+    g_free(def);
 }
 
 void virDomainSoundDefFree(virDomainSoundDefPtr def)
@@ -2832,9 +2832,9 @@ void virDomainSoundDefFree(virDomainSoundDefPtr def)
 
     for (i = 0; i < def->ncodecs; i++)
         virDomainSoundCodecDefFree(def->codecs[i]);
-    VIR_FREE(def->codecs);
+    g_free(def->codecs);
 
-    VIR_FREE(def);
+    g_free(def);
 }
 
 void virDomainAudioDefFree(virDomainAudioDefPtr def)
@@ -2844,15 +2844,15 @@ void virDomainAudioDefFree(virDomainAudioDefPtr def)
 
     switch ((virDomainAudioType) def->type) {
     case VIR_DOMAIN_AUDIO_TYPE_OSS:
-        VIR_FREE(def->backend.oss.inputDev);
-        VIR_FREE(def->backend.oss.outputDev);
+        g_free(def->backend.oss.inputDev);
+        g_free(def->backend.oss.outputDev);
         break;
 
     case VIR_DOMAIN_AUDIO_TYPE_LAST:
         break;
     }
 
-    VIR_FREE(def);
+    g_free(def);
 }
 
 virDomainSoundDefPtr
@@ -2869,9 +2869,9 @@ void virDomainMemballoonDefFree(virDomainMemballoonDefPtr def)
         return;
 
     virDomainDeviceInfoClear(&def->info);
-    VIR_FREE(def->virtio);
+    g_free(def->virtio);
 
-    VIR_FREE(def);
+    g_free(def);
 }
 
 void virDomainNVRAMDefFree(virDomainNVRAMDefPtr def)
@@ -2881,7 +2881,7 @@ void virDomainNVRAMDefFree(virDomainNVRAMDefPtr def)
 
     virDomainDeviceInfoClear(&def->info);
 
-    VIR_FREE(def);
+    g_free(def);
 }
 
 void virDomainWatchdogDefFree(virDomainWatchdogDefPtr def)
@@ -2891,7 +2891,7 @@ void virDomainWatchdogDefFree(virDomainWatchdogDefPtr def)
 
     virDomainDeviceInfoClear(&def->info);
 
-    VIR_FREE(def);
+    g_free(def);
 }
 
 void virDomainShmemDefFree(virDomainShmemDefPtr def)
@@ -2901,8 +2901,8 @@ void virDomainShmemDefFree(virDomainShmemDefPtr def)
 
     virDomainDeviceInfoClear(&def->info);
     virDomainChrSourceDefClear(&def->server.chr);
-    VIR_FREE(def->name);
-    VIR_FREE(def);
+    g_free(def->name);
+    g_free(def);
 }
 
 
@@ -2952,7 +2952,7 @@ void virDomainVideoDefFree(virDomainVideoDefPtr def)
         return;
 
     virDomainVideoDefClear(def);
-    VIR_FREE(def);
+    g_free(def);
 }
 
 
@@ -3044,15 +3044,15 @@ void virDomainTPMDefFree(virDomainTPMDefPtr def)
         break;
     case VIR_DOMAIN_TPM_TYPE_EMULATOR:
         virDomainChrSourceDefClear(&def->data.emulator.source);
-        VIR_FREE(def->data.emulator.storagepath);
-        VIR_FREE(def->data.emulator.logfile);
+        g_free(def->data.emulator.storagepath);
+        g_free(def->data.emulator.logfile);
         break;
     case VIR_DOMAIN_TPM_TYPE_LAST:
         break;
     }
 
     virDomainDeviceInfoClear(&def->info);
-    VIR_FREE(def);
+    g_free(def);
 }
 
 void virDomainHostdevDefFree(virDomainHostdevDefPtr def)
@@ -3067,7 +3067,7 @@ void virDomainHostdevDefFree(virDomainHostdevDefPtr def)
      * the memory.
      */
     if (!def->parentnet)
-        VIR_FREE(def);
+        g_free(def);
 }
 
 void virDomainHubDefFree(virDomainHubDefPtr def)
@@ -3076,7 +3076,7 @@ void virDomainHubDefFree(virDomainHubDefPtr def)
         return;
 
     virDomainDeviceInfoClear(&def->info);
-    VIR_FREE(def);
+    g_free(def);
 }
 
 void virDomainRedirdevDefFree(virDomainRedirdevDefPtr def)
@@ -3087,7 +3087,7 @@ void virDomainRedirdevDefFree(virDomainRedirdevDefPtr def)
     virObjectUnref(def->source);
     virDomainDeviceInfoClear(&def->info);
 
-    VIR_FREE(def);
+    g_free(def);
 }
 
 void virDomainRedirFilterDefFree(virDomainRedirFilterDefPtr def)
@@ -3098,10 +3098,10 @@ void virDomainRedirFilterDefFree(virDomainRedirFilterDefPtr def)
         return;
 
     for (i = 0; i < def->nusbdevs; i++)
-        VIR_FREE(def->usbdevs[i]);
+        g_free(def->usbdevs[i]);
 
-    VIR_FREE(def->usbdevs);
-    VIR_FREE(def);
+    g_free(def->usbdevs);
+    g_free(def);
 }
 
 void virDomainMemoryDefFree(virDomainMemoryDefPtr def)
@@ -3109,11 +3109,11 @@ void virDomainMemoryDefFree(virDomainMemoryDefPtr def)
     if (!def)
         return;
 
-    VIR_FREE(def->nvdimmPath);
+    g_free(def->nvdimmPath);
     virBitmapFree(def->sourceNodes);
-    VIR_FREE(def->uuid);
+    g_free(def->uuid);
     virDomainDeviceInfoClear(&def->info);
-    VIR_FREE(def);
+    g_free(def);
 }
 
 void virDomainDeviceDefFree(virDomainDeviceDefPtr def)
@@ -3189,7 +3189,7 @@ void virDomainDeviceDefFree(virDomainDeviceDefPtr def)
         virDomainMemoryDefFree(def->data.memory);
         break;
     case VIR_DOMAIN_DEVICE_IOMMU:
-        VIR_FREE(def->data.iommu);
+        g_free(def->data.iommu);
         break;
     case VIR_DOMAIN_DEVICE_VSOCK:
         virDomainVsockDefFree(def->data.vsock);
@@ -3202,7 +3202,7 @@ void virDomainDeviceDefFree(virDomainDeviceDefPtr def)
         break;
     }
 
-    VIR_FREE(def);
+    g_free(def);
 }
 
 static void
@@ -3238,7 +3238,7 @@ virDomainIOThreadIDDefFree(virDomainIOThreadIDDefPtr def)
     if (!def)
         return;
     virBitmapFree(def->cpumask);
-    VIR_FREE(def);
+    g_free(def);
 }
 
 
@@ -3254,7 +3254,7 @@ virDomainIOThreadIDDefArrayFree(virDomainIOThreadIDDefPtr *def,
     for (i = 0; i < nids; i++)
         virDomainIOThreadIDDefFree(def[i]);
 
-    VIR_FREE(def);
+    g_free(def);
 }
 
 
@@ -3311,8 +3311,8 @@ virDomainResourceDefFree(virDomainResourceDefPtr resource)
     if (!resource)
         return;
 
-    VIR_FREE(resource->partition);
-    VIR_FREE(resource);
+    g_free(resource->partition);
+    g_free(resource);
 }
 
 void
@@ -3322,7 +3322,7 @@ virDomainPanicDefFree(virDomainPanicDefPtr panic)
         return;
 
     virDomainDeviceInfoClear(&panic->info);
-    VIR_FREE(panic);
+    g_free(panic);
 }
 
 void
@@ -3331,10 +3331,10 @@ virDomainLoaderDefFree(virDomainLoaderDefPtr loader)
     if (!loader)
         return;
 
-    VIR_FREE(loader->path);
-    VIR_FREE(loader->nvram);
-    VIR_FREE(loader->templt);
-    VIR_FREE(loader);
+    g_free(loader->path);
+    g_free(loader->nvram);
+    g_free(loader->templt);
+    g_free(loader);
 }
 
 
@@ -3346,7 +3346,7 @@ virDomainResctrlMonDefFree(virDomainResctrlMonDefPtr domresmon)
 
     virBitmapFree(domresmon->vcpus);
     virObjectUnref(domresmon->instance);
-    VIR_FREE(domresmon);
+    g_free(domresmon);
 }
 
 
@@ -3363,8 +3363,8 @@ virDomainResctrlDefFree(virDomainResctrlDefPtr resctrl)
 
     virObjectUnref(resctrl->alloc);
     virBitmapFree(resctrl->vcpus);
-    VIR_FREE(resctrl->monitors);
-    VIR_FREE(resctrl);
+    g_free(resctrl->monitors);
+    g_free(resctrl);
 }
 
 
@@ -3374,10 +3374,10 @@ virDomainSEVDefFree(virDomainSEVDefPtr def)
     if (!def)
         return;
 
-    VIR_FREE(def->dh_cert);
-    VIR_FREE(def->session);
+    g_free(def->dh_cert);
+    g_free(def->session);
 
-    VIR_FREE(def);
+    g_free(def);
 }
 
 
@@ -3392,7 +3392,7 @@ void virDomainDefFree(virDomainDefPtr def)
 
     for (i = 0; i < def->maxvcpus; i++)
         virDomainVcpuDefFree(def->vcpus[i]);
-    VIR_FREE(def->vcpus);
+    g_free(def->vcpus);
 
     /* hostdevs must be freed before nets (or any future "intelligent
      * hostdevs") because the pointer to the hostdev is really
@@ -3402,133 +3402,133 @@ void virDomainDefFree(virDomainDefPtr def)
      */
     for (i = 0; i < def->nhostdevs; i++)
         virDomainHostdevDefFree(def->hostdevs[i]);
-    VIR_FREE(def->hostdevs);
+    g_free(def->hostdevs);
 
     for (i = 0; i < def->nleases; i++)
         virDomainLeaseDefFree(def->leases[i]);
-    VIR_FREE(def->leases);
+    g_free(def->leases);
 
     for (i = 0; i < def->ngraphics; i++)
         virDomainGraphicsDefFree(def->graphics[i]);
-    VIR_FREE(def->graphics);
+    g_free(def->graphics);
 
     for (i = 0; i < def->ninputs; i++)
         virDomainInputDefFree(def->inputs[i]);
-    VIR_FREE(def->inputs);
+    g_free(def->inputs);
 
     for (i = 0; i < def->ndisks; i++)
         virDomainDiskDefFree(def->disks[i]);
-    VIR_FREE(def->disks);
+    g_free(def->disks);
 
     for (i = 0; i < def->ncontrollers; i++)
         virDomainControllerDefFree(def->controllers[i]);
-    VIR_FREE(def->controllers);
+    g_free(def->controllers);
 
     for (i = 0; i < def->nfss; i++)
         virDomainFSDefFree(def->fss[i]);
-    VIR_FREE(def->fss);
+    g_free(def->fss);
 
     for (i = 0; i < def->nnets; i++)
         virDomainNetDefFree(def->nets[i]);
-    VIR_FREE(def->nets);
+    g_free(def->nets);
 
     for (i = 0; i < def->nsmartcards; i++)
         virDomainSmartcardDefFree(def->smartcards[i]);
-    VIR_FREE(def->smartcards);
+    g_free(def->smartcards);
 
     for (i = 0; i < def->nserials; i++)
         virDomainChrDefFree(def->serials[i]);
-    VIR_FREE(def->serials);
+    g_free(def->serials);
 
     for (i = 0; i < def->nparallels; i++)
         virDomainChrDefFree(def->parallels[i]);
-    VIR_FREE(def->parallels);
+    g_free(def->parallels);
 
     for (i = 0; i < def->nchannels; i++)
         virDomainChrDefFree(def->channels[i]);
-    VIR_FREE(def->channels);
+    g_free(def->channels);
 
     for (i = 0; i < def->nconsoles; i++)
         virDomainChrDefFree(def->consoles[i]);
-    VIR_FREE(def->consoles);
+    g_free(def->consoles);
 
     for (i = 0; i < def->nsounds; i++)
         virDomainSoundDefFree(def->sounds[i]);
-    VIR_FREE(def->sounds);
+    g_free(def->sounds);
 
     for (i = 0; i < def->naudios; i++)
         virDomainAudioDefFree(def->audios[i]);
-    VIR_FREE(def->audios);
+    g_free(def->audios);
 
     for (i = 0; i < def->nvideos; i++)
         virDomainVideoDefFree(def->videos[i]);
-    VIR_FREE(def->videos);
+    g_free(def->videos);
 
     for (i = 0; i < def->nhubs; i++)
         virDomainHubDefFree(def->hubs[i]);
-    VIR_FREE(def->hubs);
+    g_free(def->hubs);
 
     for (i = 0; i < def->nredirdevs; i++)
         virDomainRedirdevDefFree(def->redirdevs[i]);
-    VIR_FREE(def->redirdevs);
+    g_free(def->redirdevs);
 
     for (i = 0; i < def->nrngs; i++)
         virDomainRNGDefFree(def->rngs[i]);
-    VIR_FREE(def->rngs);
+    g_free(def->rngs);
 
     for (i = 0; i < def->nmems; i++)
         virDomainMemoryDefFree(def->mems[i]);
-    VIR_FREE(def->mems);
+    g_free(def->mems);
 
     for (i = 0; i < def->ntpms; i++)
         virDomainTPMDefFree(def->tpms[i]);
-    VIR_FREE(def->tpms);
+    g_free(def->tpms);
 
     for (i = 0; i < def->npanics; i++)
         virDomainPanicDefFree(def->panics[i]);
-    VIR_FREE(def->panics);
+    g_free(def->panics);
 
-    VIR_FREE(def->iommu);
+    g_free(def->iommu);
 
-    VIR_FREE(def->idmap.uidmap);
-    VIR_FREE(def->idmap.gidmap);
+    g_free(def->idmap.uidmap);
+    g_free(def->idmap.gidmap);
 
-    VIR_FREE(def->os.machine);
-    VIR_FREE(def->os.init);
+    g_free(def->os.machine);
+    g_free(def->os.init);
     for (i = 0; def->os.initargv && def->os.initargv[i]; i++)
-        VIR_FREE(def->os.initargv[i]);
-    VIR_FREE(def->os.initargv);
+        g_free(def->os.initargv[i]);
+    g_free(def->os.initargv);
     for (i = 0; def->os.initenv && def->os.initenv[i]; i++) {
-        VIR_FREE(def->os.initenv[i]->name);
-        VIR_FREE(def->os.initenv[i]->value);
-        VIR_FREE(def->os.initenv[i]);
-    }
-    VIR_FREE(def->os.initdir);
-    VIR_FREE(def->os.inituser);
-    VIR_FREE(def->os.initgroup);
-    VIR_FREE(def->os.initenv);
-    VIR_FREE(def->os.kernel);
-    VIR_FREE(def->os.initrd);
-    VIR_FREE(def->os.cmdline);
-    VIR_FREE(def->os.dtb);
-    VIR_FREE(def->os.root);
-    VIR_FREE(def->os.slic_table);
+        g_free(def->os.initenv[i]->name);
+        g_free(def->os.initenv[i]->value);
+        g_free(def->os.initenv[i]);
+    }
+    g_free(def->os.initdir);
+    g_free(def->os.inituser);
+    g_free(def->os.initgroup);
+    g_free(def->os.initenv);
+    g_free(def->os.kernel);
+    g_free(def->os.initrd);
+    g_free(def->os.cmdline);
+    g_free(def->os.dtb);
+    g_free(def->os.root);
+    g_free(def->os.slic_table);
     virDomainLoaderDefFree(def->os.loader);
-    VIR_FREE(def->os.bootloader);
-    VIR_FREE(def->os.bootloaderArgs);
+    g_free(def->os.bootloader);
+    g_free(def->os.bootloaderArgs);
 
     virDomainClockDefClear(&def->clock);
 
-    VIR_FREE(def->name);
+    g_free(def->name);
     virBitmapFree(def->cpumask);
-    VIR_FREE(def->emulator);
-    VIR_FREE(def->description);
-    VIR_FREE(def->title);
-    VIR_FREE(def->hyperv_vendor_id);
+    g_free(def->emulator);
+    g_free(def->description);
+    g_free(def->title);
+    g_free(def->hyperv_vendor_id);
 
     virBlkioDeviceArrayClear(def->blkio.devices,
                              def->blkio.ndevices);
-    VIR_FREE(def->blkio.devices);
+    g_free(def->blkio.devices);
 
     virDomainWatchdogDefFree(def->watchdog);
 
@@ -3538,36 +3538,36 @@ void virDomainDefFree(virDomainDefPtr def)
 
     for (i = 0; i < def->mem.nhugepages; i++)
         virBitmapFree(def->mem.hugepages[i].nodemask);
-    VIR_FREE(def->mem.hugepages);
+    g_free(def->mem.hugepages);
 
     for (i = 0; i < def->nseclabels; i++)
         virSecurityLabelDefFree(def->seclabels[i]);
-    VIR_FREE(def->seclabels);
+    g_free(def->seclabels);
 
     virCPUDefFree(def->cpu);
 
     virDomainIOThreadIDDefArrayFree(def->iothreadids, def->niothreadids);
 
     virBitmapFree(def->cputune.emulatorpin);
-    VIR_FREE(def->cputune.emulatorsched);
+    g_free(def->cputune.emulatorsched);
 
     virDomainNumaFree(def->numa);
 
     for (i = 0; i < def->nsysinfo; i++)
         virSysinfoDefFree(def->sysinfo[i]);
-    VIR_FREE(def->sysinfo);
+    g_free(def->sysinfo);
 
     virDomainRedirFilterDefFree(def->redirfilter);
 
     for (i = 0; i < def->nshmems; i++)
         virDomainShmemDefFree(def->shmems[i]);
-    VIR_FREE(def->shmems);
+    g_free(def->shmems);
 
     for (i = 0; i < def->nresctrls; i++)
         virDomainResctrlDefFree(def->resctrls[i]);
-    VIR_FREE(def->resctrls);
+    g_free(def->resctrls);
 
-    VIR_FREE(def->keywrap);
+    g_free(def->keywrap);
 
     if (def->namespaceData && def->ns.free)
         (def->ns.free)(def->namespaceData);
@@ -3576,7 +3576,7 @@ void virDomainDefFree(virDomainDefPtr def)
 
     xmlFreeNode(def->metadata);
 
-    VIR_FREE(def);
+    g_free(def);
 }
 
 static void virDomainObjDispose(void *obj)
diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c
index 7bb5ec4deb..3cd8fcee94 100644
--- a/src/conf/interface_conf.c
+++ b/src/conf/interface_conf.c
@@ -49,8 +49,8 @@ virInterfaceIPDefFree(virInterfaceIPDefPtr def)
 {
     if (def == NULL)
         return;
-    VIR_FREE(def->address);
-    VIR_FREE(def);
+    g_free(def->address);
+    g_free(def);
 }
 
 
@@ -63,10 +63,10 @@ virInterfaceProtocolDefFree(virInterfaceProtocolDefPtr def)
         return;
     for (i = 0; i < def->nips; i++)
         virInterfaceIPDefFree(def->ips[i]);
-    VIR_FREE(def->ips);
-    VIR_FREE(def->family);
-    VIR_FREE(def->gateway);
-    VIR_FREE(def);
+    g_free(def->ips);
+    g_free(def->family);
+    g_free(def->gateway);
+    g_free(def);
 }
 
 
@@ -79,39 +79,39 @@ virInterfaceDefFree(virInterfaceDefPtr def)
     if (def == NULL)
         return;
 
-    VIR_FREE(def->name);
-    VIR_FREE(def->mac);
+    g_free(def->name);
+    g_free(def->mac);
 
     switch (def->type) {
         case VIR_INTERFACE_TYPE_BRIDGE:
-            VIR_FREE(def->data.bridge.delay);
+            g_free(def->data.bridge.delay);
             for (i = 0; i < def->data.bridge.nbItf; i++) {
                 if (def->data.bridge.itf[i] == NULL)
                     break; /* to cope with half parsed data on errors */
                 virInterfaceDefFree(def->data.bridge.itf[i]);
             }
-            VIR_FREE(def->data.bridge.itf);
+            g_free(def->data.bridge.itf);
             break;
         case VIR_INTERFACE_TYPE_BOND:
-            VIR_FREE(def->data.bond.target);
+            g_free(def->data.bond.target);
             for (i = 0; i < def->data.bond.nbItf; i++) {
                 if (def->data.bond.itf[i] == NULL)
                     break; /* to cope with half parsed data on errors */
                 virInterfaceDefFree(def->data.bond.itf[i]);
             }
-            VIR_FREE(def->data.bond.itf);
+            g_free(def->data.bond.itf);
             break;
         case VIR_INTERFACE_TYPE_VLAN:
-            VIR_FREE(def->data.vlan.tag);
-            VIR_FREE(def->data.vlan.dev_name);
+            g_free(def->data.vlan.tag);
+            g_free(def->data.vlan.dev_name);
             break;
     }
 
     /* free all protos */
     for (pp = 0; pp < def->nprotos; pp++)
         virInterfaceProtocolDefFree(def->protos[pp]);
-    VIR_FREE(def->protos);
-    VIR_FREE(def);
+    g_free(def->protos);
+    g_free(def);
 }
 
 
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index ff7a56f4f4..f32710b781 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -258,28 +258,28 @@ virNetworkDefFree(virNetworkDefPtr def)
     if (!def)
         return;
 
-    VIR_FREE(def->name);
-    VIR_FREE(def->bridge);
-    VIR_FREE(def->bridgeZone);
-    VIR_FREE(def->domain);
+    g_free(def->name);
+    g_free(def->bridge);
+    g_free(def->bridgeZone);
+    g_free(def->domain);
 
     virNetworkForwardDefClear(&def->forward);
 
     for (i = 0; i < def->nips && def->ips; i++)
         virNetworkIPDefClear(&def->ips[i]);
-    VIR_FREE(def->ips);
+    g_free(def->ips);
 
     for (i = 0; i < def->nroutes && def->routes; i++)
         virNetDevIPRouteFree(def->routes[i]);
-    VIR_FREE(def->routes);
+    g_free(def->routes);
 
     for (i = 0; i < def->nPortGroups && def->portGroups; i++)
         virPortGroupDefClear(&def->portGroups[i]);
-    VIR_FREE(def->portGroups);
+    g_free(def->portGroups);
 
     virNetworkDNSDefClear(&def->dns);
 
-    VIR_FREE(def->virtPortProfile);
+    g_free(def->virtPortProfile);
 
     virNetDevBandwidthFree(def->bandwidth);
     virNetDevVlanClear(&def->vlan);
@@ -288,7 +288,7 @@ virNetworkDefFree(virNetworkDefPtr def)
 
     if (def->namespaceData && def->ns.free)
         (def->ns.free)(def->namespaceData);
-    VIR_FREE(def);
+    g_free(def);
 }
 
 
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index b6f73161b5..1093a461af 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -108,15 +108,15 @@ virNodeDeviceDefFree(virNodeDeviceDefPtr def)
     if (!def)
         return;
 
-    VIR_FREE(def->name);
-    VIR_FREE(def->parent);
-    VIR_FREE(def->parent_wwnn);
-    VIR_FREE(def->parent_wwpn);
-    VIR_FREE(def->parent_fabric_wwn);
-    VIR_FREE(def->driver);
-    VIR_FREE(def->sysfs_path);
-    VIR_FREE(def->parent_sysfs_path);
-    VIR_FREE(def->devnode);
+    g_free(def->name);
+    g_free(def->parent);
+    g_free(def->parent_wwnn);
+    g_free(def->parent_wwpn);
+    g_free(def->parent_fabric_wwn);
+    g_free(def->driver);
+    g_free(def->sysfs_path);
+    g_free(def->parent_sysfs_path);
+    g_free(def->devnode);
     g_strfreev(def->devlinks);
 
     caps = def->caps;
@@ -126,7 +126,7 @@ virNodeDeviceDefFree(virNodeDeviceDefPtr def)
         caps = next;
     }
 
-    VIR_FREE(def);
+    g_free(def);
 }
 
 
@@ -2388,83 +2388,83 @@ virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps)
 
     switch (caps->data.type) {
     case VIR_NODE_DEV_CAP_SYSTEM:
-        VIR_FREE(data->system.product_name);
-        VIR_FREE(data->system.hardware.vendor_name);
-        VIR_FREE(data->system.hardware.version);
-        VIR_FREE(data->system.hardware.serial);
-        VIR_FREE(data->system.firmware.vendor_name);
-        VIR_FREE(data->system.firmware.version);
-        VIR_FREE(data->system.firmware.release_date);
+        g_free(data->system.product_name);
+        g_free(data->system.hardware.vendor_name);
+        g_free(data->system.hardware.version);
+        g_free(data->system.hardware.serial);
+        g_free(data->system.firmware.vendor_name);
+        g_free(data->system.firmware.version);
+        g_free(data->system.firmware.release_date);
         break;
     case VIR_NODE_DEV_CAP_PCI_DEV:
-        VIR_FREE(data->pci_dev.product_name);
-        VIR_FREE(data->pci_dev.vendor_name);
-        VIR_FREE(data->pci_dev.physical_function);
+        g_free(data->pci_dev.product_name);
+        g_free(data->pci_dev.vendor_name);
+        g_free(data->pci_dev.physical_function);
         for (i = 0; i < data->pci_dev.num_virtual_functions; i++)
-            VIR_FREE(data->pci_dev.virtual_functions[i]);
-        VIR_FREE(data->pci_dev.virtual_functions);
+            g_free(data->pci_dev.virtual_functions[i]);
+        g_free(data->pci_dev.virtual_functions);
         for (i = 0; i < data->pci_dev.nIommuGroupDevices; i++)
-            VIR_FREE(data->pci_dev.iommuGroupDevices[i]);
-        VIR_FREE(data->pci_dev.iommuGroupDevices);
+            g_free(data->pci_dev.iommuGroupDevices[i]);
+        g_free(data->pci_dev.iommuGroupDevices);
         virPCIEDeviceInfoFree(data->pci_dev.pci_express);
         for (i = 0; i < data->pci_dev.nmdev_types; i++)
             virMediatedDeviceTypeFree(data->pci_dev.mdev_types[i]);
-        VIR_FREE(data->pci_dev.mdev_types);
+        g_free(data->pci_dev.mdev_types);
         break;
     case VIR_NODE_DEV_CAP_USB_DEV:
-        VIR_FREE(data->usb_dev.product_name);
-        VIR_FREE(data->usb_dev.vendor_name);
+        g_free(data->usb_dev.product_name);
+        g_free(data->usb_dev.vendor_name);
         break;
     case VIR_NODE_DEV_CAP_USB_INTERFACE:
-        VIR_FREE(data->usb_if.description);
+        g_free(data->usb_if.description);
         break;
     case VIR_NODE_DEV_CAP_NET:
-        VIR_FREE(data->net.ifname);
-        VIR_FREE(data->net.address);
+        g_free(data->net.ifname);
+        g_free(data->net.address);
         virBitmapFree(data->net.features);
         break;
     case VIR_NODE_DEV_CAP_SCSI_HOST:
-        VIR_FREE(data->scsi_host.wwnn);
-        VIR_FREE(data->scsi_host.wwpn);
-        VIR_FREE(data->scsi_host.fabric_wwn);
+        g_free(data->scsi_host.wwnn);
+        g_free(data->scsi_host.wwpn);
+        g_free(data->scsi_host.fabric_wwn);
         break;
     case VIR_NODE_DEV_CAP_SCSI_TARGET:
-        VIR_FREE(data->scsi_target.name);
-        VIR_FREE(data->scsi_target.rport);
-        VIR_FREE(data->scsi_target.wwpn);
+        g_free(data->scsi_target.name);
+        g_free(data->scsi_target.rport);
+        g_free(data->scsi_target.wwpn);
         break;
     case VIR_NODE_DEV_CAP_SCSI:
-        VIR_FREE(data->scsi.type);
+        g_free(data->scsi.type);
         break;
     case VIR_NODE_DEV_CAP_STORAGE:
-        VIR_FREE(data->storage.block);
-        VIR_FREE(data->storage.bus);
-        VIR_FREE(data->storage.drive_type);
-        VIR_FREE(data->storage.model);
-        VIR_FREE(data->storage.vendor);
-        VIR_FREE(data->storage.serial);
-        VIR_FREE(data->storage.media_label);
+        g_free(data->storage.block);
+        g_free(data->storage.bus);
+        g_free(data->storage.drive_type);
+        g_free(data->storage.model);
+        g_free(data->storage.vendor);
+        g_free(data->storage.serial);
+        g_free(data->storage.media_label);
         break;
     case VIR_NODE_DEV_CAP_SCSI_GENERIC:
-        VIR_FREE(data->sg.path);
+        g_free(data->sg.path);
         break;
     case VIR_NODE_DEV_CAP_MDEV:
-        VIR_FREE(data->mdev.type);
-        VIR_FREE(data->mdev.uuid);
+        g_free(data->mdev.type);
+        g_free(data->mdev.uuid);
         for (i = 0; i < data->mdev.nattributes; i++)
             virMediatedDeviceAttrFree(data->mdev.attributes[i]);
-        VIR_FREE(data->mdev.attributes);
+        g_free(data->mdev.attributes);
         break;
     case VIR_NODE_DEV_CAP_CSS_DEV:
         for (i = 0; i < data->ccw_dev.nmdev_types; i++)
             virMediatedDeviceTypeFree(data->ccw_dev.mdev_types[i]);
-        VIR_FREE(data->ccw_dev.mdev_types);
+        g_free(data->ccw_dev.mdev_types);
         break;
     case VIR_NODE_DEV_CAP_AP_MATRIX:
-        VIR_FREE(data->ap_matrix.addr);
+        g_free(data->ap_matrix.addr);
         for (i = 0; i < data->ap_matrix.nmdev_types; i++)
             virMediatedDeviceTypeFree(data->ap_matrix.mdev_types[i]);
-        VIR_FREE(data->ap_matrix.mdev_types);
+        g_free(data->ap_matrix.mdev_types);
         break;
     case VIR_NODE_DEV_CAP_MDEV_TYPES:
     case VIR_NODE_DEV_CAP_DRM:
@@ -2479,7 +2479,7 @@ virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps)
         break;
     }
 
-    VIR_FREE(caps);
+    g_free(caps);
 }
 
 
diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index be684c3512..fbb87b7acf 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -309,12 +309,12 @@ virNWFilterRuleDefFree(virNWFilterRuleDefPtr def)
         virNWFilterVarAccessFree(def->varAccess[i]);
 
     for (i = 0; i < def->nstrings; i++)
-        VIR_FREE(def->strings[i]);
+        g_free(def->strings[i]);
 
-    VIR_FREE(def->varAccess);
-    VIR_FREE(def->strings);
+    g_free(def->varAccess);
+    g_free(def->strings);
 
-    VIR_FREE(def);
+    g_free(def);
 }
 
 
@@ -324,8 +324,8 @@ virNWFilterIncludeDefFree(virNWFilterIncludeDefPtr inc)
     if (!inc)
         return;
     virHashFree(inc->params);
-    VIR_FREE(inc->filterref);
-    VIR_FREE(inc);
+    g_free(inc->filterref);
+    g_free(inc);
 }
 
 
@@ -337,7 +337,7 @@ virNWFilterEntryFree(virNWFilterEntryPtr entry)
 
     virNWFilterRuleDefFree(entry->rule);
     virNWFilterIncludeDefFree(entry->include);
-    VIR_FREE(entry);
+    g_free(entry);
 }
 
 
@@ -348,15 +348,15 @@ virNWFilterDefFree(virNWFilterDefPtr def)
     if (!def)
         return;
 
-    VIR_FREE(def->name);
+    g_free(def->name);
 
     for (i = 0; i < def->nentries; i++)
         virNWFilterEntryFree(def->filterEntries[i]);
 
-    VIR_FREE(def->filterEntries);
-    VIR_FREE(def->chainsuffix);
+    g_free(def->filterEntries);
+    g_free(def->chainsuffix);
 
-    VIR_FREE(def);
+    g_free(def);
 }
 
 
diff --git a/src/conf/nwfilter_params.c b/src/conf/nwfilter_params.c
index ae819024ad..18b64e373b 100644
--- a/src/conf/nwfilter_params.c
+++ b/src/conf/nwfilter_params.c
@@ -50,17 +50,17 @@ virNWFilterVarValueFree(virNWFilterVarValuePtr val)
 
     switch (val->valType) {
     case NWFILTER_VALUE_TYPE_SIMPLE:
-        VIR_FREE(val->u.simple.value);
+        g_free(val->u.simple.value);
         break;
     case NWFILTER_VALUE_TYPE_ARRAY:
         for (i = 0; i < val->u.array.nValues; i++)
-            VIR_FREE(val->u.array.values[i]);
-        VIR_FREE(val->u.array.values);
+            g_free(val->u.array.values[i]);
+        g_free(val->u.array.values);
         break;
     case NWFILTER_VALUE_TYPE_LAST:
         break;
     }
-    VIR_FREE(val);
+    g_free(val);
 }
 
 virNWFilterVarValuePtr
@@ -302,9 +302,9 @@ virNWFilterVarCombIterFree(virNWFilterVarCombIterPtr ci)
         return;
 
     for (i = 0; i < ci->nIter; i++)
-        VIR_FREE(ci->iter[i].varNames);
+        g_free(ci->iter[i].varNames);
 
-    VIR_FREE(ci);
+    g_free(ci);
 }
 
 static int
@@ -809,8 +809,8 @@ virNWFilterVarAccessFree(virNWFilterVarAccessPtr varAccess)
     if (!varAccess)
         return;
 
-    VIR_FREE(varAccess->varName);
-    VIR_FREE(varAccess);
+    g_free(varAccess->varName);
+    g_free(varAccess);
 }
 
 bool
diff --git a/src/conf/object_event.c b/src/conf/object_event.c
index 28e75f8b59..907aa6d06a 100644
--- a/src/conf/object_event.c
+++ b/src/conf/object_event.c
@@ -140,8 +140,8 @@ virObjectEventCallbackFree(virObjectEventCallbackPtr cb)
         return;
 
     virObjectUnref(cb->conn);
-    VIR_FREE(cb->key);
-    VIR_FREE(cb);
+    g_free(cb->key);
+    g_free(cb);
 }
 
 /**
@@ -161,10 +161,10 @@ virObjectEventCallbackListFree(virObjectEventCallbackListPtr list)
         virFreeCallback freecb = list->callbacks[i]->freecb;
         if (freecb)
             (*freecb)(list->callbacks[i]->opaque);
-        VIR_FREE(list->callbacks[i]);
+        g_free(list->callbacks[i]);
     }
-    VIR_FREE(list->callbacks);
-    VIR_FREE(list);
+    g_free(list->callbacks);
+    g_free(list);
 }
 
 
@@ -494,7 +494,7 @@ virObjectEventQueueFree(virObjectEventQueuePtr queue)
         return;
 
     virObjectEventQueueClear(queue);
-    VIR_FREE(queue);
+    g_free(queue);
 }
 
 static virObjectEventQueuePtr
diff --git a/src/conf/secret_conf.c b/src/conf/secret_conf.c
index 4d7d685d6e..3341f5d83c 100644
--- a/src/conf/secret_conf.c
+++ b/src/conf/secret_conf.c
@@ -43,9 +43,9 @@ virSecretDefFree(virSecretDefPtr def)
     if (def == NULL)
         return;
 
-    VIR_FREE(def->description);
-    VIR_FREE(def->usage_id);
-    VIR_FREE(def);
+    g_free(def->description);
+    g_free(def->usage_id);
+    g_free(def);
 }
 
 static int
diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
index 0b78699589..df88a0bc72 100644
--- a/src/conf/snapshot_conf.c
+++ b/src/conf/snapshot_conf.c
@@ -105,7 +105,7 @@ virDomainSnapshotDiskDefFree(virDomainSnapshotDiskDefPtr disk)
         return;
 
     virDomainSnapshotDiskDefClear(disk);
-    VIR_FREE(disk);
+    g_free(disk);
 }
 
 
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 9aed602fd6..3f06fcaebf 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -448,15 +448,15 @@ virStorageVolDefFree(virStorageVolDefPtr def)
     if (!def)
         return;
 
-    VIR_FREE(def->name);
-    VIR_FREE(def->key);
+    g_free(def->name);
+    g_free(def->key);
 
     for (i = 0; i < def->source.nextent; i++)
-        VIR_FREE(def->source.extents[i].path);
-    VIR_FREE(def->source.extents);
+        g_free(def->source.extents[i].path);
+    g_free(def->source.extents);
 
     virStorageSourceClear(&def->target);
-    VIR_FREE(def);
+    g_free(def);
 }
 
 
@@ -497,7 +497,7 @@ void
 virStoragePoolSourceFree(virStoragePoolSourcePtr source)
 {
     virStoragePoolSourceClear(source);
-    VIR_FREE(source);
+    g_free(source);
 }
 
 
@@ -507,16 +507,16 @@ virStoragePoolDefFree(virStoragePoolDefPtr def)
     if (!def)
         return;
 
-    VIR_FREE(def->name);
+    g_free(def->name);
 
     virStoragePoolSourceClear(&def->source);
 
-    VIR_FREE(def->target.path);
-    VIR_FREE(def->target.perms.label);
-    VIR_FREE(def->refresh);
+    g_free(def->target.path);
+    g_free(def->target.perms.label);
+    g_free(def->refresh);
     if (def->namespaceData && def->ns.free)
         (def->ns.free)(def->namespaceData);
-    VIR_FREE(def);
+    g_free(def);
 }
 
 
diff --git a/src/conf/storage_encryption_conf.c b/src/conf/storage_encryption_conf.c
index 6a32df15b7..7fd0df70a9 100644
--- a/src/conf/storage_encryption_conf.c
+++ b/src/conf/storage_encryption_conf.c
@@ -78,8 +78,8 @@ virStorageEncryptionFree(virStorageEncryptionPtr enc)
     for (i = 0; i < enc->nsecrets; i++)
         virStorageEncryptionSecretFree(enc->secrets[i]);
     virStorageEncryptionInfoDefClear(&enc->encinfo);
-    VIR_FREE(enc->secrets);
-    VIR_FREE(enc);
+    g_free(enc->secrets);
+    g_free(enc);
 }
 
 static virStorageEncryptionSecretPtr
diff --git a/src/conf/storage_source_conf.c b/src/conf/storage_source_conf.c
index dab5e855f5..3eaf05fe52 100644
--- a/src/conf/storage_source_conf.c
+++ b/src/conf/storage_source_conf.c
@@ -159,7 +159,7 @@ virStorageNetHostDefFree(size_t nhosts,
     for (i = 0; i < nhosts; i++)
         virStorageNetHostDefClear(&hosts[i]);
 
-    VIR_FREE(hosts);
+    g_free(hosts);
 }
 
 
@@ -169,8 +169,8 @@ virStoragePermsFree(virStoragePermsPtr def)
     if (!def)
         return;
 
-    VIR_FREE(def->label);
-    VIR_FREE(def);
+    g_free(def->label);
+    g_free(def);
 }
 
 
@@ -204,10 +204,10 @@ virStorageAuthDefFree(virStorageAuthDefPtr authdef)
     if (!authdef)
         return;
 
-    VIR_FREE(authdef->username);
-    VIR_FREE(authdef->secrettype);
+    g_free(authdef->username);
+    g_free(authdef->secrettype);
     virSecretLookupDefClear(&authdef->seclookupdef);
-    VIR_FREE(authdef);
+    g_free(authdef);
 }
 
 
@@ -314,9 +314,9 @@ virStoragePRDefFree(virStoragePRDefPtr prd)
     if (!prd)
         return;
 
-    VIR_FREE(prd->path);
-    VIR_FREE(prd->mgralias);
-    VIR_FREE(prd);
+    g_free(prd->path);
+    g_free(prd->mgralias);
+    g_free(prd);
 }
 
 
@@ -511,7 +511,7 @@ virStorageSourceNVMeDefFree(virStorageSourceNVMeDefPtr def)
     if (!def)
         return;
 
-    VIR_FREE(def);
+    g_free(def);
 }
 
 
@@ -992,10 +992,10 @@ virStorageSourcePoolDefFree(virStorageSourcePoolDefPtr def)
     if (!def)
         return;
 
-    VIR_FREE(def->pool);
-    VIR_FREE(def->volume);
+    g_free(def->pool);
+    g_free(def->volume);
 
-    VIR_FREE(def);
+    g_free(def);
 }
 
 
diff --git a/src/conf/virdomaincheckpointobjlist.c b/src/conf/virdomaincheckpointobjlist.c
index e09137b69b..a8025055c2 100644
--- a/src/conf/virdomaincheckpointobjlist.c
+++ b/src/conf/virdomaincheckpointobjlist.c
@@ -78,7 +78,7 @@ virDomainCheckpointObjListFree(virDomainCheckpointObjListPtr checkpoints)
     if (!checkpoints)
         return;
     virDomainMomentObjListFree(checkpoints->base);
-    VIR_FREE(checkpoints);
+    g_free(checkpoints);
 }
 
 
diff --git a/src/conf/virdomainmomentobjlist.c b/src/conf/virdomainmomentobjlist.c
index 999f4a4152..7d639c4e01 100644
--- a/src/conf/virdomainmomentobjlist.c
+++ b/src/conf/virdomainmomentobjlist.c
@@ -229,7 +229,7 @@ virDomainMomentObjFree(virDomainMomentObjPtr moment)
     VIR_DEBUG("obj=%p", moment);
 
     virObjectUnref(moment->def);
-    VIR_FREE(moment);
+    g_free(moment);
 }
 
 
@@ -289,7 +289,7 @@ virDomainMomentObjListFree(virDomainMomentObjListPtr moments)
     if (!moments)
         return;
     virHashFree(moments->objs);
-    VIR_FREE(moments);
+    g_free(moments);
 }
 
 
diff --git a/src/conf/virdomainsnapshotobjlist.c b/src/conf/virdomainsnapshotobjlist.c
index 7c2b63c5ae..4c7176b95e 100644
--- a/src/conf/virdomainsnapshotobjlist.c
+++ b/src/conf/virdomainsnapshotobjlist.c
@@ -101,7 +101,7 @@ virDomainSnapshotObjListFree(virDomainSnapshotObjListPtr snapshots)
     if (!snapshots)
         return;
     virDomainMomentObjListFree(snapshots->base);
-    VIR_FREE(snapshots);
+    g_free(snapshots);
 }
 
 
diff --git a/src/conf/virnetworkportdef.c b/src/conf/virnetworkportdef.c
index 244a168357..21ebbdb054 100644
--- a/src/conf/virnetworkportdef.c
+++ b/src/conf/virnetworkportdef.c
@@ -45,12 +45,12 @@ virNetworkPortDefFree(virNetworkPortDefPtr def)
     if (!def)
         return;
 
-    VIR_FREE(def->ownername);
-    VIR_FREE(def->group);
+    g_free(def->ownername);
+    g_free(def->group);
 
     virNetDevBandwidthFree(def->bandwidth);
     virNetDevVlanClear(&def->vlan);
-    VIR_FREE(def->virtPortProfile);
+    g_free(def->virtPortProfile);
 
     switch ((virNetworkPortPlugType)def->plugtype) {
     case VIR_NETWORK_PORT_PLUG_TYPE_NONE:
@@ -58,11 +58,11 @@ virNetworkPortDefFree(virNetworkPortDefPtr def)
 
     case VIR_NETWORK_PORT_PLUG_TYPE_NETWORK:
     case VIR_NETWORK_PORT_PLUG_TYPE_BRIDGE:
-        VIR_FREE(def->plug.bridge.brname);
+        g_free(def->plug.bridge.brname);
         break;
 
     case VIR_NETWORK_PORT_PLUG_TYPE_DIRECT:
-        VIR_FREE(def->plug.direct.linkdev);
+        g_free(def->plug.direct.linkdev);
         break;
 
     case VIR_NETWORK_PORT_PLUG_TYPE_HOSTDEV_PCI:
@@ -73,7 +73,7 @@ virNetworkPortDefFree(virNetworkPortDefPtr def)
         break;
     }
 
-    VIR_FREE(def);
+    g_free(def);
 }
 
 
diff --git a/src/conf/virnwfilterbindingdef.c b/src/conf/virnwfilterbindingdef.c
index 28c1c3938c..a3f90b86bb 100644
--- a/src/conf/virnwfilterbindingdef.c
+++ b/src/conf/virnwfilterbindingdef.c
@@ -36,13 +36,13 @@ virNWFilterBindingDefFree(virNWFilterBindingDefPtr def)
     if (!def)
         return;
 
-    VIR_FREE(def->ownername);
-    VIR_FREE(def->portdevname);
-    VIR_FREE(def->linkdevname);
-    VIR_FREE(def->filter);
+    g_free(def->ownername);
+    g_free(def->portdevname);
+    g_free(def->linkdevname);
+    g_free(def->filter);
     virHashFree(def->filterparams);
 
-    VIR_FREE(def);
+    g_free(def);
 }
 
 
diff --git a/src/conf/virnwfilterobj.c b/src/conf/virnwfilterobj.c
index a6a5aa01c7..3157522eb2 100644
--- a/src/conf/virnwfilterobj.c
+++ b/src/conf/virnwfilterobj.c
@@ -99,7 +99,7 @@ virNWFilterObjFree(virNWFilterObjPtr obj)
 
     virMutexDestroy(&obj->lock);
 
-    VIR_FREE(obj);
+    g_free(obj);
 }
 
 
@@ -109,8 +109,8 @@ virNWFilterObjListFree(virNWFilterObjListPtr nwfilters)
     size_t i;
     for (i = 0; i < nwfilters->count; i++)
         virNWFilterObjFree(nwfilters->objs[i]);
-    VIR_FREE(nwfilters->objs);
-    VIR_FREE(nwfilters);
+    g_free(nwfilters->objs);
+    g_free(nwfilters);
 }
 
 
-- 
2.29.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