[Mesa-dev] [PATCH] vl/dri: fix close fd error out

Emil Velikov emil.l.velikov at gmail.com
Thu May 12 15:10:51 UTC 2016


On 12 May 2016 at 15:10, Leo Liu <leo.liu at amd.com> wrote:
> fd should be set to -1 only if it got closed by pipe_loader_release.
>
> Signed-off-by: Leo Liu <leo.liu at amd.com>
> ---
>  src/gallium/auxiliary/vl/vl_winsys_dri.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri.c b/src/gallium/auxiliary/vl/vl_winsys_dri.c
> index 0136526..4636feb 100644
> --- a/src/gallium/auxiliary/vl/vl_winsys_dri.c
> +++ b/src/gallium/auxiliary/vl/vl_winsys_dri.c
> @@ -427,9 +427,10 @@ vl_dri2_screen_create(Display *display, int screen)
>     return &scrn->base;
>
>  release_pipe:
> -   if (scrn->base.dev)
> +   if (scrn->base.dev) {
>        pipe_loader_release(&scrn->base.dev, 1);
> -   fd = -1;
> +      fd = -1;
> +   }
>  free_authenticate:
>     free(authenticate);
>  close_fd:
+if (fd != -1)
.... close(fd)

Please add a -1 check before the close.

Thanks
Emil


More information about the mesa-dev mailing list