[libvirt] [PATCH] nwfilter: Free nwfilter hash of virConnectPtr

Stefan Berger stefanb at us.ibm.com
Sat Apr 17 18:48:23 UTC 2010


libvir-list-bounces at redhat.com wrote on 04/17/2010 12:23:24 PM:


> libvir-list-bounces at redhat.com
> 
> And close the driver on connection close.
> ---
>  src/datatypes.c |   20 ++++++++++++++++++++
>  1 files changed, 20 insertions(+), 0 deletions(-)
> 
> diff --git a/src/datatypes.c b/src/datatypes.c
> index ebcd538..25962a6 100644
> --- a/src/datatypes.c
> +++ b/src/datatypes.c
> @@ -129,6 +129,20 @@ virSecretFreeName(void *secret_, const char 
> *name ATTRIBUTE_UNUSED)
>  }
> 
>  /**
> + * virNWFilterPoolFreeName:
> + * @pool: a nwfilter pool object
> + *
> + * Destroy the nwfilter pool object, this is just used by the 
> nwfilter pool hash callback.
> + *
> + * Returns 0 in case of success and -1 in case of failure.
> + */
> +static int
> +virNWFilterPoolFreeName(virNWFilterPtr pool, const char *name 
> ATTRIBUTE_UNUSED)
> +{
> +    return (virUnrefNWFilter(pool));
> +}
> +
> +/**
>   * virDomainSnapshotFreeName:
>   * @snapshot: a domain snapshotobject
>   *
> @@ -212,6 +226,8 @@ failed:
>              virHashFree(ret->nodeDevices, (virHashDeallocator) 
> virNodeDeviceFree);
>          if (ret->secrets != NULL)
>              virHashFree(ret->secrets, virSecretFreeName);
> +        if (ret->nwfilterPools != NULL)
> +            virHashFree(ret->nwfilterPools, (virHashDeallocator) 
> virNWFilterPoolFreeName);
> 
>          virMutexDestroy(&ret->lock);
>          VIR_FREE(ret);
> @@ -245,6 +261,8 @@ virReleaseConnect(virConnectPtr conn) {
>          virHashFree(conn->nodeDevices, (virHashDeallocator) 
> virNodeDeviceFree);
>      if (conn->secrets != NULL)
>          virHashFree(conn->secrets, virSecretFreeName);
> +    if (conn->nwfilterPools != NULL)
> +        virHashFree(conn->nwfilterPools, (virHashDeallocator) 
> virNWFilterPoolFreeName);
> 
>      virResetError(&conn->err);
> 
> @@ -292,6 +310,8 @@ virUnrefConnect(virConnectPtr conn) {
>              conn->deviceMonitor->close (conn);
>          if (conn->secretDriver)
>              conn->secretDriver->close (conn);
> +        if (conn->nwfilterDriver)
> +            conn->nwfilterDriver->close (conn);
>          if (conn->driver)
>              conn->driver->close (conn);

Ack, please push.

  Stefan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100417/42b91d5b/attachment-0001.htm>


More information about the libvir-list mailing list