evas: Fix resource leak in evas_module_find_type

Coverity reports a resource leak here if we successfully load the evas
module as we were never freeing the eina_module here. Previously we
would just return the evas module without proper cleanup of the
eina_module. This patch fixes the leak by calling eina_module_free if
we successfully load the evas module.

Fixes CID1367503

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2017-01-25 08:53:41 -05:00
parent 54655d65a3
commit 8b2ca30eb5
1 changed files with 5 additions and 1 deletions

View File

@ -574,7 +574,11 @@ evas_module_find_type(Evas_Module_Type type, const char *name)
em = eina_hash_find(evas_modules[type], name);
if (em)
{
if (evas_module_load(em)) return em;
if (evas_module_load(em))
{
eina_module_free(en);
return em;
}
}
eina_module_free(en);