[libvirt PATCH v2 15/15] nwfilter: convert remaining VIR_FREE() to g_free()

Ján Tomko jtomko at redhat.com
Wed Jul 15 15:49:47 UTC 2020


On a Tuesday in 2020, Laine Stump wrote:
>Signed-off-by: Laine Stump <laine at redhat.com>
>---
> src/nwfilter/nwfilter_dhcpsnoop.c         | 16 ++++++++--------
> src/nwfilter/nwfilter_driver.c            | 10 +++++-----
> src/nwfilter/nwfilter_ebiptables_driver.c |  2 +-
> src/nwfilter/nwfilter_gentech_driver.c    |  6 +++---
> src/nwfilter/nwfilter_learnipaddr.c       |  8 ++++----
> 5 files changed, 21 insertions(+), 21 deletions(-)
>
>diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c
>index 64671af135..aafa6de322 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_free(*threadKey);

This one should use g_clear_pointer.

>
>     virNWFilterSnoopActiveUnlock();
> }
>diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
>index 39d0a2128e..7853ad59fa 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_free(driver);

Same here.

>
>     return VIR_DRV_STATE_INIT_ERROR;
> }
>@@ -379,7 +379,7 @@ nwfilterStateCleanup(void)
>     virNWFilterObjListFree(driver->nwfilters);
>
>     virMutexDestroy(&driver->lock);
>-    VIR_FREE(driver);
>+    g_free(driver);
>

Possibly here.

>     return 0;
> }

(I have not verified whether the double use of the pointer may
practically happen, but we do a non-NULL check of these in a few cases)

Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20200715/fdd920b1/attachment-0001.sig>


More information about the libvir-list mailing list