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.
This commit is contained in:
Jaehyun Cho 2020-08-03 15:54:35 +09:00
parent 87bcc82976
commit 52df41b217
1 changed files with 7 additions and 1 deletions

View File

@ -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);