[Mesa-stable] [PATCH 2/4] egl/surfaceless: Set disp->DriverData to NULL on error

Nicolas Boichat drinkcat at chromium.org
Thu Aug 4 02:07:52 UTC 2016


Avoid use-after-free on error.

Fixes: 9ee683f877 (egl/dri2: Add reference count for dri2_egl_display)
Cc: "12.0" <mesa-stable at lists.freedesktop.org>
Signed-off-by: Nicolas Boichat <drinkcat at chromium.org>
---
 src/egl/drivers/dri2/platform_surfaceless.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/egl/drivers/dri2/platform_surfaceless.c b/src/egl/drivers/dri2/platform_surfaceless.c
index 8ce6162..e0d383b 100644
--- a/src/egl/drivers/dri2/platform_surfaceless.c
+++ b/src/egl/drivers/dri2/platform_surfaceless.c
@@ -362,6 +362,7 @@ cleanup_driver:
    close(dri2_dpy->fd);
 cleanup_display:
    free(dri2_dpy);
+   disp->DriverData = NULL;
 
    return _eglError(EGL_NOT_INITIALIZED, err);
 }
-- 
2.8.0.rc3.226.g39d4020



More information about the mesa-stable mailing list