diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c index 64671af135..649c4441ab 100644 --- a/src/nwfilter/nwfilter_dhcpsnoop.c +++ b/src/nwfilter/nwfilter_dhcpsnoop.c @@ -314,7 +314,7 @@ virNWFilterSnoopCancel(char **threadKey) virNWFilterSnoopActiveLock(); ignore_value(virHashRemoveEntry(virNWFilterSnoopState.active, *threadKey)); - VIR_FREE(*threadKey); + g_clear_pointer(threadKey, g_free); virNWFilterSnoopActiveUnlock(); } @@ -600,7 +600,7 @@ virNWFilterSnoopReqFree(virNWFilterSnoopReqPtr req) virCondDestroy(&req->threadStatusCond); virFreeError(req->threadError); - VIR_FREE(req); + g_free(req); } /* @@ -731,7 +731,7 @@ virNWFilterSnoopReqLeaseAdd(virNWFilterSnoopReqPtr req, if (req->threadkey && virNWFilterSnoopIPLeaseInstallRule(pl, true) < 0) { virNWFilterSnoopReqUnlock(req); - VIR_FREE(pl); + g_free(pl); return -1; } @@ -850,7 +850,7 @@ virNWFilterSnoopReqLeaseDel(virNWFilterSnoopReqPtr req, } skip_instantiate: - VIR_FREE(ipl); + g_free(ipl); ignore_value(!!g_atomic_int_dec_and_test(&virNWFilterSnoopState.nLeases)); @@ -1149,7 +1149,7 @@ virNWFilterSnoopDHCPDecodeJobSubmit(virThreadPoolPtr pool, if (ret == 0) g_atomic_int_add(qCtr, 1); else - VIR_FREE(job); + g_free(job); return ret; } @@ -1502,7 +1502,7 @@ virNWFilterDHCPSnoopThread(void *req0) ignore_value(virHashRemoveEntry(virNWFilterSnoopState.ifnameToKey, req->binding->portdevname)); - VIR_FREE(req->binding->portdevname); + g_clear_pointer(&req->binding->portdevname, g_free); virNWFilterSnoopReqUnlock(req); virNWFilterSnoopUnlock(); @@ -1970,7 +1970,7 @@ virNWFilterSnoopRemAllReqIter(const void *payload, */ virNWFilterIPAddrMapDelIPAddr(req->binding->portdevname, NULL); - VIR_FREE(req->binding->portdevname); + g_clear_pointer(&req->binding->portdevname, g_free); } virNWFilterSnoopReqUnlock(req); @@ -2079,7 +2079,7 @@ virNWFilterDHCPSnoopEnd(const char *ifname) /* keep valid lease req; drop interface association */ virNWFilterSnoopCancel(&req->threadkey); - VIR_FREE(req->binding->portdevname); + g_clear_pointer(&req->binding->portdevname, g_free); virNWFilterSnoopReqUnlock(req); diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c index 39d0a2128e..77c4467816 100644 --- a/src/nwfilter/nwfilter_driver.c +++ b/src/nwfilter/nwfilter_driver.c @@ -303,7 +303,7 @@ nwfilterStateInitialize(bool privileged, err_free_driverstate: virNWFilterObjListFree(driver->nwfilters); - VIR_FREE(driver); + g_clear_pointer(&driver, g_free); return VIR_DRV_STATE_INIT_ERROR; } @@ -367,9 +367,9 @@ nwfilterStateCleanup(void) if (driver->lockFD != -1) virPidFileRelease(driver->stateDir, "driver", driver->lockFD); - VIR_FREE(driver->stateDir); - VIR_FREE(driver->configDir); - VIR_FREE(driver->bindingDir); + g_free(driver->stateDir); + g_free(driver->configDir); + g_free(driver->bindingDir); nwfilterDriverUnlock(); } @@ -379,7 +379,7 @@ nwfilterStateCleanup(void) virNWFilterObjListFree(driver->nwfilters); virMutexDestroy(&driver->lock); - VIR_FREE(driver); + g_clear_pointer(&driver, g_free); return 0; } diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c index 9c9d63f14b..6aefbe226b 100644 --- a/src/nwfilter/nwfilter_ebiptables_driver.c +++ b/src/nwfilter/nwfilter_ebiptables_driver.c @@ -3517,7 +3517,7 @@ ebiptablesApplyNewRules(const char *ifname, cleanup: for (i = 0; i < nsubchains; i++) - VIR_FREE(subchains[i]); + g_free(subchains[i]); return ret; } diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter_gentech_driver.c index 071f15caea..c93f2ed18f 100644 --- a/src/nwfilter/nwfilter_gentech_driver.c +++ b/src/nwfilter/nwfilter_gentech_driver.c @@ -122,7 +122,7 @@ virNWFilterRuleInstFree(virNWFilterRuleInstPtr inst) return; virHashFree(inst->vars); - VIR_FREE(inst); + g_free(inst); } @@ -234,12 +234,12 @@ virNWFilterInstReset(virNWFilterInstPtr inst) for (i = 0; i < inst->nfilters; i++) virNWFilterObjUnlock(inst->filters[i]); - VIR_FREE(inst->filters); + g_free(inst->filters); inst->nfilters = 0; for (i = 0; i < inst->nrules; i++) virNWFilterRuleInstFree(inst->rules[i]); - VIR_FREE(inst->rules); + g_free(inst->rules); inst->nrules = 0; } diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c index abef0b6457..c6497450eb 100644 --- a/src/nwfilter/nwfilter_learnipaddr.c +++ b/src/nwfilter/nwfilter_learnipaddr.c @@ -156,7 +156,7 @@ virNWFilterLockIface(const char *ifname) if (virMutexInitRecursive(&ifaceLock->lock) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("mutex initialization failed")); - VIR_FREE(ifaceLock); + g_free(ifaceLock); goto error; } @@ -165,12 +165,12 @@ virNWFilterLockIface(const char *ifname) _("interface name %s does not fit into " "buffer "), ifaceLock->ifname); - VIR_FREE(ifaceLock); + g_free(ifaceLock); goto error; } while (virHashAddEntry(ifaceLockMap, ifname, ifaceLock)) { - VIR_FREE(ifaceLock); + g_free(ifaceLock); goto error; } @@ -221,7 +221,7 @@ virNWFilterIPAddrLearnReqFree(virNWFilterIPAddrLearnReqPtr req) virNWFilterBindingDefFree(req->binding); - VIR_FREE(req); + g_free(req); }