summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2014-05-16 14:43:09 +0100
committerTom Hacohen <tom@stosb.com>2014-05-16 14:43:09 +0100
commit61f3f68670e8e49258edb19e2c2aebdde30b605a (patch)
treeeddade3ad981b5c458c249b9ed59049d77a3737b
parentcdea54dd40480817db4a97ffd107d7408af29972 (diff)
downloadefl-61f3f68670e8e49258edb19e2c2aebdde30b605a.tar.gz
Eo: Make it clearer that a NULL deref can't happen.
We check _current_table for NULL, and then populate it (it's a global) through another function, but we don't really check it's not NULL before using it, we just assume because of an indirect other variable. This confused coveritiy, can confuse humans too, and in general risky (if something changes). CID 1039419
-rw-r--r--src/lib/eo/eo_ptr_indirection.x5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/eo/eo_ptr_indirection.x b/src/lib/eo/eo_ptr_indirection.x
index 61fd1837be..4efe667e3c 100644
--- a/src/lib/eo/eo_ptr_indirection.x
+++ b/src/lib/eo/eo_ptr_indirection.x
@@ -392,10 +392,11 @@ _eo_id_allocate(const _Eo_Object *obj)
if (!entry)
{
entry = _search_tables();
- if (!entry)
- return 0;
}
+ if (!_current_table || !entry)
+ return 0;
+
/* [1;max-1] thus we never generate an Eo_Id equal to 0 */
_eo_generation_counter++;
if (_eo_generation_counter == MAX_GENERATIONS)