[Mesa-dev] [PATCH] egl_dri2: cleanup memory leak in dri2_create_context()

Emil Velikov emil.l.velikov at gmail.com
Thu May 8 08:49:45 PDT 2014


Cc: Kristian Høgsberg <krh at bitplanet.net>
Cc: Chad Versace <chad.versace at linux.intel.com>
Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
 src/egl/drivers/dri2/egl_dri2.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 380bd7b..a5f71ed 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -811,8 +811,9 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
          api = __DRI_API_GLES3;
          break;
       default:
-	 _eglError(EGL_BAD_PARAMETER, "eglCreateContext");
-	 return NULL;
+         _eglError(EGL_BAD_PARAMETER, "eglCreateContext");
+         free(dri2_ctx);
+         return NULL;
       }
       break;
    case EGL_OPENGL_API:
-- 
1.9.2



More information about the mesa-dev mailing list