On Tue,  9 May 2017 12:04:51 -0700
Stefano Stabellini <sstabell...@kernel.org> wrote:

> CID: 1374836
> 
> Signed-off-by: Stefano Stabellini <sstabell...@kernel.org>
> CC: anthony.per...@citrix.com
> CC: gr...@kaod.org
> CC: aneesh.ku...@linux.vnet.ibm.com
> ---
>  hw/9pfs/xen-9p-backend.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/hw/9pfs/xen-9p-backend.c b/hw/9pfs/xen-9p-backend.c
> index 9c7f41a..a1fdede 100644
> --- a/hw/9pfs/xen-9p-backend.c
> +++ b/hw/9pfs/xen-9p-backend.c
> @@ -332,12 +332,14 @@ static int xen_9pfs_connect(struct XenDevice *xendev)
>          str = g_strdup_printf("ring-ref%u", i);
>          if (xenstore_read_fe_int(&xen_9pdev->xendev, str,
>                                   &xen_9pdev->rings[i].ref) == -1) {
> +            g_free(str);
>              goto out;
>          }
>          g_free(str);

I would rather do something like:

    int ret;

    [...]

        str = g_strdup_printf("ring-ref%u", i);
        ret = xenstore_read_fe_int(&xen_9pdev->xendev, str,
                                   &xen_9pdev->rings[i].ref);
        g_free(str);
        if (ret ==  -1) {
            goto out;
        }

but this is a matter of taste and you own this code so:

Reviewed-by: Greg Kurz <gr...@kaod.org>

>          str = g_strdup_printf("event-channel-%u", i);
>          if (xenstore_read_fe_int(&xen_9pdev->xendev, str,
>                                   &xen_9pdev->rings[i].evtchn) == -1) {
> +            g_free(str);
>              goto out;
>          }
>          g_free(str);

Attachment: pgpSpemgmCMyg.pgp
Description: OpenPGP digital signature

Reply via email to