egl/dri2: don't leak the fd on dri2_terminate
authorEmil Velikov <emil.l.velikov@gmail.com>
Thu, 10 Sep 2015 13:41:38 +0000 (14:41 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Tue, 15 Sep 2015 11:39:02 +0000 (12:39 +0100)
commita1ac742f709089eabad59b4da484799091203d91
tree5206e1169c688908cf2ec7f2629277d98fd7b6f8
parentbd5bcb5b8ca043a3908d7a70ab1193efc1db278d
egl/dri2: don't leak the fd on dri2_terminate

Currently the check was incorrect as it did not consider the (unlikely)
case of fd == 0. In order to fix this we should first correctly
initialize it to -1, as the swrast implementations leave it set to zero
(props to calloc()).

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Boyan Ding <boyan.j.ding@gmail.com>
src/egl/drivers/dri2/egl_dri2.c
src/egl/drivers/dri2/platform_wayland.c
src/egl/drivers/dri2/platform_x11.c