summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaehyun Cho <jae_hyun.cho@samsung.com>2020-08-03 15:54:35 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2020-08-03 18:43:36 +0900
commit52df41b2179d2b2b01dd8b31054d38dc28e4327e (patch)
tree30c6253fd192cfee6bb8761283b5cba969a761f9
parent87bcc82976be023027dea04d1761fad58819846e (diff)
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.
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_core.c8
1 files changed, 7 insertions, 1 deletions
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:
88static void 88static void
89_internal_resources_destroy(void *eng_data, EVGL_Resource *rsc) 89_internal_resources_destroy(void *eng_data, EVGL_Resource *rsc)
90{ 90{
91 if ((!eng_data) || (!rsc)) return; 91 if (!rsc) return;
92
93 if (!eng_data)
94 {
95 free(rsc);
96 return;
97 }
92 98
93 if (rsc->context) 99 if (rsc->context)
94 evgl_engine->funcs->context_destroy(eng_data, rsc->context); 100 evgl_engine->funcs->context_destroy(eng_data, rsc->context);