summaryrefslogtreecommitdiffstats
path: root/src/egl/drivers/dri2/platform_drm.c
diff options
context:
space:
mode:
authorEmil Velikov <[email protected]>2015-06-18 20:16:46 +0100
committerEmil Velikov <[email protected]>2015-06-30 17:34:11 +0100
commit6098ef824467f685fb34914eb3fef73b3ba18c6f (patch)
tree98c53effa311f12fbd2065df9dbadcca2625d98b /src/egl/drivers/dri2/platform_drm.c
parent879dcf07f6a3ab56f23d540b0df94c57e0706094 (diff)
egl/drm: plug memory leak
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 <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/egl/drivers/dri2/platform_drm.c')
-rw-r--r--src/egl/drivers/dri2/platform_drm.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
index a62da4121fe..0d1f4c6e0a7 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;