egl/surfaceless: Set disp->DriverData to NULL on error
authorNicolas Boichat <drinkcat@chromium.org>
Thu, 4 Aug 2016 02:07:52 +0000 (10:07 +0800)
committerEmil Velikov <emil.l.velikov@gmail.com>
Mon, 15 Aug 2016 18:00:30 +0000 (19:00 +0100)
Avoid use-after-free on error.

Fixes: 9ee683f877 (egl/dri2: Add reference count for dri2_egl_display)
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Martin Peres <martin.peres@linux.intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
src/egl/drivers/dri2/platform_surfaceless.c

index 8ce6162fcc6396637ef564882c25164937cfd0fb..e0d383ba3836991947b68677e00b4501a01359ab 100644 (file)
@@ -362,6 +362,7 @@ cleanup_driver:
    close(dri2_dpy->fd);
 cleanup_display:
    free(dri2_dpy);
+   disp->DriverData = NULL;
 
    return _eglError(EGL_NOT_INITIALIZED, err);
 }