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(a)virtuozzo.com>
---
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