egl: check for driver_configs in dri2_display_release
authorTapani Pälli <tapani.palli@intel.com>
Fri, 12 May 2017 09:18:32 +0000 (12:18 +0300)
committerEmil Velikov <emil.l.velikov@gmail.com>
Mon, 29 May 2017 15:49:49 +0000 (16:49 +0100)
With later commits we'll split and reuse the destroy side of the
function for the initialize_foo error path.

In such cases, driver_configs may be NULL leading to a crash.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
[Emil Velikov: reword commit message]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Rob Herring <robh@kernel.org>
src/egl/drivers/dri2/egl_dri2.c

index 405db61d18501024756d140e73757b0bd781a9e5..eefe3bfc5832c74d205ef5a92510d55c517e3184 100644 (file)
@@ -919,7 +919,7 @@ dri2_display_release(_EGLDisplay *disp)
     * the ones from the gbm device. As such the gbm itself is responsible
     * for the cleanup.
     */
-   if (disp->Platform != _EGL_PLATFORM_DRM) {
+   if (disp->Platform != _EGL_PLATFORM_DRM && dri2_dpy->driver_configs) {
       for (i = 0; dri2_dpy->driver_configs[i]; i++)
          free((__DRIconfig *) dri2_dpy->driver_configs[i]);
       free(dri2_dpy->driver_configs);