summaryrefslogtreecommitdiff
path: root/src/lib/evil
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 /src/lib/evil
parent629b5e3d2bc268b5e48b03c91ccabf030d2b7f51 (diff)
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>
Diffstat (limited to 'src/lib/evil')
-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)
65int 65int
66evil_shutdown(void) 66evil_shutdown(void)
67{ 67{
68 /* _evil_init_count should not go below zero. */
69 if (_evil_init_count < 1)
70 {
71 ERR("Evil shutdown called without calling evil init.\n");
72 return 0;
73 }
74
68 if (--_evil_init_count != 0) 75 if (--_evil_init_count != 0)
69 return _evil_init_count; 76 return _evil_init_count;
70 77