[libvirt] [PATCH 2/5] Reference state when using it as opaque
Michal Privoznik
mprivozn at redhat.com
Wed Oct 12 09:09:59 UTC 2016
On 11.10.2016 20:53, Martin Kletzander wrote:
> 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 at 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);
> +
Maybe worth adding a short comment that one ref is held by the event loop?
ACK
Michal
More information about the libvir-list
mailing list