Repository : ssh://git@open-mesh.org/alfred
On branch : master
commit 4ea6bec3827dd9f4ba54927b41228b5bc7aa0559 Author: Sven Eckelmann sven@narfation.org Date: Thu Nov 23 13:21:42 2017 +0100
alfred: Handle failure during hash iterator allocation
The hash_iterate functions should not try to start the iteration when the iterator could not be allocated.
Signed-off-by: Sven Eckelmann sven@narfation.org Signed-off-by: Simon Wunderlich sw@simonwunderlich.de
4ea6bec3827dd9f4ba54927b41228b5bc7aa0559 hash.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/hash.c b/hash.c index 5a3cdef..116e46f 100644 --- a/hash.c +++ b/hash.c @@ -116,6 +116,9 @@ struct hash_it_t *hash_iterate(struct hashtable_t *hash,
if (!iter_in) { iter = debugMalloc(sizeof(struct hash_it_t), 301); + if (!iter) + return NULL; + iter->index = -1; iter->bucket = NULL; iter->prev_bucket = NULL;