From: Chris Michael Date: Wed, 7 Jun 2017 16:38:12 +0000 (-0400) Subject: evas-gl-drm: Fix potential memory leak X-Git-Tag: upstream/1.20.0~734 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=45656ccb80f937f442fa47ef247b0cf6452856bb;p=platform%2Fupstream%2Fefl.git evas-gl-drm: Fix potential memory leak If/When we exit _evas_outbuf_egl_setup function, we should be freeing the allocated cfgs variable else we leak it. @fix Signed-off-by: Chris Michael --- diff --git a/src/modules/evas/engines/gl_drm/evas_outbuf.c b/src/modules/evas/engines/gl_drm/evas_outbuf.c index 89eef8c..4606c08 100644 --- a/src/modules/evas/engines/gl_drm/evas_outbuf.c +++ b/src/modules/evas/engines/gl_drm/evas_outbuf.c @@ -263,7 +263,7 @@ _evas_outbuf_egl_setup(Outbuf *ob) ncfg, &ncfg) || (ncfg == 0)) { ERR("eglChooseConfig() fail. code=%#x", eglGetError()); - return EINA_FALSE; + goto err; } for (; i < ncfg; ++i) @@ -274,7 +274,7 @@ _evas_outbuf_egl_setup(Outbuf *ob) &format)) { ERR("eglGetConfigAttrib() fail. code=%#x", eglGetError()); - return EINA_FALSE; + goto err; } if (format == (int)ob->info->info.format) @@ -297,7 +297,7 @@ _evas_outbuf_egl_setup(Outbuf *ob) { ERR("eglCreateWindowSurface() fail for %p. code=%#x", ob->surface, eglGetError()); - return EINA_FALSE; + goto err; } ob->egl.context = @@ -305,7 +305,7 @@ _evas_outbuf_egl_setup(Outbuf *ob) if (ob->egl.context == EGL_NO_CONTEXT) { ERR("eglCreateContext() fail. code=%#x", eglGetError()); - return EINA_FALSE; + goto err; } if (context == EGL_NO_CONTEXT) context = ob->egl.context; @@ -314,7 +314,7 @@ _evas_outbuf_egl_setup(Outbuf *ob) ob->egl.surface, ob->egl.context) == EGL_FALSE) { ERR("eglMakeCurrent() fail. code=%#x", eglGetError()); - return EINA_FALSE; + goto err; } vendor = glGetString(GL_VENDOR); @@ -349,11 +349,11 @@ _evas_outbuf_egl_setup(Outbuf *ob) ERR("Vendor: %s", (const char *)vendor); ERR("Renderer: %s", (const char *)renderer); ERR("Version: %s", (const char *)version); - return EINA_FALSE; + goto err; } ob->gl_context = glsym_evas_gl_common_context_new(); - if (!ob->gl_context) return EINA_FALSE; + if (!ob->gl_context) goto err; #ifdef GL_GLES ob->gl_context->egldisp = ob->egl.disp; @@ -366,7 +366,12 @@ _evas_outbuf_egl_setup(Outbuf *ob) ob->surf = EINA_TRUE; + free(cfgs); return EINA_TRUE; + +err: + free(cfgs); + return EINA_FALSE; } Outbuf *