cedric pushed a commit to branch master.

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

commit a2d40968dfc9287ba39f0f02fb9bee97ec3b7370
Author: Srivardhan Hebbar <[email protected]>
Date:   Thu Feb 5 11:26:58 2015 +0100

    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 <[email protected]>
---
 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 7ad692b..a21e6df 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

-- 


Reply via email to