[PATCH 2/5] Reference state when using it as opaque

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

 



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@xxxxxxxxxx>
---
 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

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