egl: check for driver_configs in dri2_display_release

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>
This commit is contained in:
Tapani Pälli 2017-05-12 12:18:32 +03:00 committed by Emil Velikov
parent 628af2bc96
commit 12196d1b76
1 changed files with 1 additions and 1 deletions

View 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);