Re: [libvirt] [PATCH] Fix ref-counting for Xen driver event registration

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

 



john.levon@xxxxxxx wrote:
> Fix ref-counting for Xen driver event registration
> diff --git a/src/xen_unified.c b/src/xen_unified.c
> --- a/src/xen_unified.c
> +++ b/src/xen_unified.c
> @@ -1359,15 +1359,21 @@ xenUnifiedDomainEventRegister (virConnec
>                                 void *opaque,
>                                 void (*freefunc)(void *))
>  {
> +    int ret;
> +
>      GET_PRIVATE (conn);
>      if (priv->xsWatch == -1) {
>          xenUnifiedError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
>          return -1;
>      }
>
> -    conn->refs++;
> -    return virDomainEventCallbackListAdd(conn, priv->domainEventCallbacks,
> -                                         callback, opaque, freefunc);
> +    ret = virDomainEventCallbackListAdd(conn, priv->domainEventCallbacks,
> +        callback, opaque, freefunc);

This looks like a fine change, too, but please adjust it not
to change the indentation of the above continuation line:

    ret = virDomainEventCallbackListAdd(conn, priv->domainEventCallbacks,
                                        callback, opaque, freefunc);

> +
> +    if (ret == 0)
> +        conn->refs++;
> +
> +    return (ret);
>  }
>
>  static int
> @@ -1382,8 +1388,10 @@ xenUnifiedDomainEventDeregister (virConn
>      }
>
>      ret = virDomainEventCallbackListRemove(conn, priv->domainEventCallbacks,
> -                                            callback);
> -    virUnrefConnect(conn);
> +        callback);

Same here.

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