mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 11:28:05 +02:00
egl_dri2: fix double free on drm platforms
Earlier commit failed to attribure that for drm platforms one does not call dri2_create_screen, thus it does not create the screen and driver_configs but inherits them from the "display" - gbm. As such wrap cleanup in Platform != _EGL_PLATFORM_DRM to prevent the issue and still cleanup correctly for non-drm platforms. v2: - Drop the ifdef HAVE_DRM_PLATFORM, reindent the code and fix the comment block. Suggested by Ken. Reported-by: Kenneth Graunke <kenneth@whitecape.org> Reported-by: Mark Janes <mark.a.janes@intel.com> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-and-tested-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
This commit is contained in:
parent
9a0a4d67a9
commit
38cec0303b
1 changed files with 9 additions and 3 deletions
|
|
@ -707,9 +707,15 @@ dri2_terminate(_EGLDriver *drv, _EGLDisplay *disp)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; dri2_dpy->driver_configs[i]; i++)
|
/* The drm platform does not create the screen/driver_configs but reuses
|
||||||
free((__DRIconfig *) dri2_dpy->driver_configs[i]);
|
* the ones from the gbm device. As such the gbm itself is responsible
|
||||||
free(dri2_dpy->driver_configs);
|
* for the cleanup.
|
||||||
|
*/
|
||||||
|
if (disp->Platform != _EGL_PLATFORM_DRM) {
|
||||||
|
for (i = 0; dri2_dpy->driver_configs[i]; i++)
|
||||||
|
free((__DRIconfig *) dri2_dpy->driver_configs[i]);
|
||||||
|
free(dri2_dpy->driver_configs);
|
||||||
|
}
|
||||||
free(dri2_dpy);
|
free(dri2_dpy);
|
||||||
disp->DriverData = NULL;
|
disp->DriverData = NULL;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue