Skip to contentSkip to conversation

alfred: Handle failure during hash iterator allocation

PATCH Applied Sven Eckelmann 2 participants 2 messages Nov 23, 2017 – Dec 1, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 alfred: Handle failure during hash iterator allocation

From: Sven Eckelmann <[email protected]>

The hash_iterate functions should not try to start the iteration when the iterator could not be allocated.

---
 hash.c | 3 +++
 1 file changed, 3 insertions(+)
hash.c +3 -0
index 5a3cdef..116e46f 100644
@@ -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;
Signature · 1 line
2.11.0
#1 lore raw
Quoted 5 lines · CET Sven Eckelmann

From: Sven Eckelmann <[email protected]>

The hash_iterate functions should not try to start the iteration when the iterator could not be allocated.

Applied in 4ea6bec

Thank you,
Simon