There should be one more reference because it is being kept in the list
of callbacks as an opaque. We also unref it properly using
virObjectFreeCallback.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/conf/object_event.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/conf/object_event.c b/src/conf/object_event.c
index b859835b47a1..5994c2574d6f 100644
--- a/src/conf/object_event.c
+++ b/src/conf/object_event.c
@@ -870,12 +870,14 @@ virObjectEventStateRegisterID(virConnectPtr conn,
(state->timer = virEventAddTimeout(-1,
virObjectEventTimer,
state,
- NULL)) < 0) {
+ virObjectFreeCallback)) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("could not initialize domain event timer"));
goto cleanup;
}
+ virObjectRef(state);
+
ret = virObjectEventCallbackListAddID(conn, state->callbacks,
key, filter, filter_opaque,
klass, eventID,
--
2.10.1