[libvirt] [PATCH 09/20] test: testConnectClose: Set privateData to NULL in all cases

Marc Hartmayer posted 20 patches 7 years, 2 months ago
[libvirt] [PATCH 09/20] test: testConnectClose: Set privateData to NULL in all cases
Posted by Marc Hartmayer 7 years, 2 months ago
Set privateData to NULL also for a connection that uses @defaultConn
as privateData regardless of whether @defaultConn was freed or
not. @defaultConn is shared between multiple connections and it's
ensured that there will be no memory leak by counting references.

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
---
 src/test/test_driver.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index b0ce7d0eea0a..5561d0c2ae70 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -1482,6 +1482,7 @@ static int testConnectClose(virConnectPtr conn)
         dflt = true;
         virMutexLock(&defaultLock);
         if (--defaultConnections) {
+            conn->privateData = NULL;
             virMutexUnlock(&defaultLock);
             return 0;
         }
-- 
2.13.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 09/20] test: testConnectClose: Set privateData to NULL in all cases
Posted by John Ferlan 7 years, 1 month ago

On 03/08/2018 07:20 AM, Marc Hartmayer wrote:
> Set privateData to NULL also for a connection that uses @defaultConn
> as privateData regardless of whether @defaultConn was freed or
> not. @defaultConn is shared between multiple connections and it's
> ensured that there will be no memory leak by counting references.
> 
> Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
> Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
> ---
>  src/test/test_driver.c | 1 +
>  1 file changed, 1 insertion(+)
> 

Reviewed-by: John Ferlan <jferlan@redhat.com>

John

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