From a2d40968dfc9287ba39f0f02fb9bee97ec3b7370 Mon Sep 17 00:00:00 2001 From: Srivardhan Hebbar Date: Thu, 5 Feb 2015 11:26:58 +0100 Subject: [PATCH] Ecore_con: fix initialisation clean up and avoid memory leak. Summary: When ecore_init failed or when failed to initialize ecore_con_log_domain, then evil_shutdown was not called. So cleaned up code and added the fix. @fix Reviewers: cedric Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D1921 Signed-off-by: Cedric BAIL --- src/lib/ecore_con/ecore_con.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/lib/ecore_con/ecore_con.c b/src/lib/ecore_con/ecore_con.c index 7ad692b706..a21e6df8b4 100644 --- a/src/lib/ecore_con/ecore_con.c +++ b/src/lib/ecore_con/ecore_con.c @@ -194,16 +194,12 @@ ecore_con_init(void) #endif if (!ecore_init()) - return --_ecore_con_init_count; + goto ecore_err; _ecore_con_log_dom = eina_log_domain_register ("ecore_con", ECORE_CON_DEFAULT_LOG_COLOR); if (_ecore_con_log_dom < 0) - { - EINA_LOG_ERR("Impossible to create a log domain for Ecore Con."); - ecore_shutdown(); - return --_ecore_con_init_count; - } + goto ecore_con_log_error; ecore_con_mempool_init(); @@ -237,6 +233,16 @@ ecore_con_init(void) EINA_LOG_STATE_INIT); return _ecore_con_init_count; + +ecore_con_log_error: + EINA_LOG_ERR("Failed to create a log domain for Ecore Con."); + ecore_shutdown(); + +ecore_err: +#ifdef HAVE_EVIL + evil_shutdown(); +#endif + return --_ecore_con_init_count; } EAPI int