cedric pushed a commit to branch master.

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

commit a9a027509c0753ebb366143e6c3c37892c8991ed
Author: Srivardhan Hebbar <sri.heb...@samsung.com>
Date:   Thu Feb 5 11:24:36 2015 +0100

    evil: prevent _evil_init_count from going below zero.
    
    Summary: _evil_init_count should never go below zero. This can occur, if a 
developer mistakenly calls evil_shutdown before calling evil_init. So fixing 
the code so that it never goes below zero.
    
    Reviewers: cedric
    
    Subscribers: cedric
    
    Differential Revision: https://phab.enlightenment.org/D1922
    
    Signed-off-by: Cedric BAIL <ced...@osg.samsung.com>
---
 src/lib/evil/evil_main.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/lib/evil/evil_main.c b/src/lib/evil/evil_main.c
index ee1eb1d..2c30ebb 100644
--- a/src/lib/evil/evil_main.c
+++ b/src/lib/evil/evil_main.c
@@ -65,6 +65,13 @@ evil_init(void)
 int
 evil_shutdown(void)
 {
+   /* _evil_init_count should not go below zero. */
+   if (_evil_init_count < 1)
+     {
+        ERR("Evil shutdown called without calling evil init.\n");
+        return 0;
+     }
+
    if (--_evil_init_count != 0)
      return _evil_init_count;
 

-- 


Reply via email to