summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSrivardhan Hebbar <sri.hebbar@samsung.com>2015-02-05 11:24:36 +0100
committerCedric BAIL <cedric@osg.samsung.com>2015-02-05 11:24:40 +0100
commita9a027509c0753ebb366143e6c3c37892c8991ed (patch)
tree377d2a04880f9012562555ba1ebb13acd77e543e
parent629b5e3d2bc268b5e48b03c91ccabf030d2b7f51 (diff)
downloadefl-a9a027509c0753ebb366143e6c3c37892c8991ed.tar.gz
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 <cedric@osg.samsung.com>
-rw-r--r--src/lib/evil/evil_main.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lib/evil/evil_main.c b/src/lib/evil/evil_main.c
index ee1eb1d113..2c30ebb513 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;