mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-24 13:35:17 +00:00
Reference state when using it as opaque
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@redhat.com>
This commit is contained in:
parent
1827f2ac5d
commit
3d279e23e7
@ -870,12 +870,16 @@ virObjectEventStateRegisterID(virConnectPtr conn,
|
|||||||
(state->timer = virEventAddTimeout(-1,
|
(state->timer = virEventAddTimeout(-1,
|
||||||
virObjectEventTimer,
|
virObjectEventTimer,
|
||||||
state,
|
state,
|
||||||
NULL)) < 0) {
|
virObjectFreeCallback)) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("could not initialize domain event timer"));
|
_("could not initialize domain event timer"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* event loop has one reference, but we need one more for the
|
||||||
|
* timer's opaque argument */
|
||||||
|
virObjectRef(state);
|
||||||
|
|
||||||
ret = virObjectEventCallbackListAddID(conn, state->callbacks,
|
ret = virObjectEventCallbackListAddID(conn, state->callbacks,
|
||||||
key, filter, filter_opaque,
|
key, filter, filter_opaque,
|
||||||
klass, eventID,
|
klass, eventID,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user