[PATCH v3 2/8] virConnectCloseCallbackData: fix connection object refcount

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

 



We have reference to connection object in virConnectCloseCallbackData
object thus we have to refcount it. Obviously we have problems
in dispose and call functions. Let's fix it.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@xxxxxxxxxxxxx>
---
 src/datatypes.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/datatypes.c b/src/datatypes.c
index 3750557..73c7e7e 100644
--- a/src/datatypes.c
+++ b/src/datatypes.c
@@ -176,6 +176,7 @@ virConnectCloseCallbackDataDispose(void *obj)
 
     if (cb->freeCallback)
         cb->freeCallback(cb->opaque);
+    virObjectUnref(cb->conn);
 
     virObjectUnlock(cb);
 }
@@ -227,6 +228,7 @@ int virConnectCloseCallbackDataUnregister(virConnectCloseCallbackDataPtr close,
         close->freeCallback(close->opaque);
     close->freeCallback = NULL;
     virObjectUnref(close->conn);
+    close->conn = NULL;
 
     ret = 0;
 
@@ -251,6 +253,8 @@ void virConnectCloseCallbackDataCall(virConnectCloseCallbackDataPtr close,
         close->freeCallback(close->opaque);
     close->callback = NULL;
     close->freeCallback = NULL;
+    virObjectUnref(close->conn);
+    close->conn = NULL;
 
  exit:
     virObjectUnlock(close);
-- 
1.8.3.1

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