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

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

 



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);
 
-- 
1.6.3.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[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]