Mesa (master): egl/drm: plug memory leak

Emil Velikov evelikov at kemper.freedesktop.org
Tue Jun 30 16:32:02 UTC 2015


Module: Mesa
Branch: master
Commit: 6098ef824467f685fb34914eb3fef73b3ba18c6f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6098ef824467f685fb34914eb3fef73b3ba18c6f

Author: Emil Velikov <emil.l.velikov at gmail.com>
Date:   Thu Jun 18 20:16:46 2015 +0100

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 <emil.l.velikov at gmail.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.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;




More information about the mesa-commit mailing list