[Mesa-dev] [PATCH 1/4] egl/drm: plug memory leak
Emil Velikov
emil.l.velikov at gmail.com
Fri Jun 26 05:04:49 PDT 2015
Free the memory for dri2_surf in the unlikely case that one provides
NULL for native_window. Also set the relevant EGL_ERROR to provide
feedback to the user.
Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
src/egl/drivers/dri2/platform_drm.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
index a62da41..0d1f4c6 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -115,8 +115,11 @@ dri2_drm_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
switch (type) {
case EGL_WINDOW_BIT:
- if (!window)
- return NULL;
+ if (!window) {
+ _eglError(EGL_BAD_NATIVE_WINDOW, "dri2_create_surface");
+ goto cleanup_surf;
+ }
+
surf = gbm_dri_surface(window);
dri2_surf->gbm_surf = surf;
dri2_surf->base.Width = surf->base.width;
--
2.4.4
More information about the mesa-dev
mailing list