jaehyun pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=52df41b2179d2b2b01dd8b31054d38dc28e4327e

commit 52df41b2179d2b2b01dd8b31054d38dc28e4327e
Author: Jaehyun Cho <[email protected]>
Date:   Mon Aug 3 15:54:35 2020 +0900

    evas_gl_core: fix memory leak of EVGL_Resource
    
    If eng_data is NULL and rsc is not NULL in _internal_resources_destroy,
    then the allocated EVGL_Resource rsc is not free.
    
    To resolve this memory leak, eng_data and rsc are checked separately.
---
 src/modules/evas/engines/gl_common/evas_gl_core.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/modules/evas/engines/gl_common/evas_gl_core.c 
b/src/modules/evas/engines/gl_common/evas_gl_core.c
index 96d0807c39..786c54c825 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_core.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_core.c
@@ -88,7 +88,13 @@ error:
 static void
 _internal_resources_destroy(void *eng_data, EVGL_Resource *rsc)
 {
-   if ((!eng_data) || (!rsc)) return;
+   if (!rsc) return;
+
+   if (!eng_data)
+     {
+        free(rsc);
+        return;
+     }
 
    if (rsc->context)
      evgl_engine->funcs->context_destroy(eng_data, rsc->context);

-- 


Reply via email to