Return-Path: From: Sven Eckelmann Date: Thu, 23 Nov 2017 13:21:42 +0100 Message-Id: <20171123122142.2968-1-sven.eckelmann@openmesh.com> Subject: [B.A.T.M.A.N.] [PATCH] alfred: Handle failure during hash iterator allocation List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: b.a.t.m.a.n@lists.open-mesh.org From: Sven Eckelmann The hash_iterate functions should not try to start the iteration when the iterator could not be allocated. Signed-off-by: Sven Eckelmann --- 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; -- 2.11.0