summaryrefslogtreecommitdiffstats
path: root/src/egl/drivers/dri2/platform_wayland.c
diff options
context:
space:
mode:
authorEmil Velikov <emil.l.velikov@gmail.com>2015-09-10 14:41:38 +0100
committerEmil Velikov <emil.l.velikov@gmail.com>2015-09-15 12:39:02 +0100
commita1ac742f709089eabad59b4da484799091203d91 (patch)
tree5206e1169c688908cf2ec7f2629277d98fd7b6f8 /src/egl/drivers/dri2/platform_wayland.c
parentbd5bcb5b8ca043a3908d7a70ab1193efc1db278d (diff)
downloadexternal_mesa3d-a1ac742f709089eabad59b4da484799091203d91.zip
external_mesa3d-a1ac742f709089eabad59b4da484799091203d91.tar.gz
external_mesa3d-a1ac742f709089eabad59b4da484799091203d91.tar.bz2
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>
Diffstat (limited to 'src/egl/drivers/dri2/platform_wayland.c')
-rw-r--r--src/egl/drivers/dri2/platform_wayland.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index dbc64ba..6cf5461 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -1804,6 +1804,7 @@ dri2_initialize_wayland_swrast(_EGLDriver *drv, _EGLDisplay *disp)
if (roundtrip(dri2_dpy) < 0 || dri2_dpy->formats == 0)
goto cleanup_shm;
+ dri2_dpy->fd = -1;
dri2_dpy->driver_name = strdup("swrast");
if (!dri2_load_driver_swrast(disp))
goto cleanup_shm;