Repository : ssh://git@open-mesh.org/batctl
On branch : next
commit 690d846ed6620f1f0a8fabbfef120ca6f796c2ad Author: Sven Eckelmann sven@narfation.org Date: Sat May 24 15:56:17 2014 +0200
batctl: Free hash iterator when breaking out of loop
The hash iterator is automatically allocated and freed by the hash_iterate function. But when using break (or goto outside of loop) during the iteration loop, the caller has to handle the free-operation of the hash_iterator to avoid memory leaks.
Signed-off-by: Sven Eckelmann sven@narfation.org Signed-off-by: Marek Lindner mareklindner@neomailbox.ch
690d846ed6620f1f0a8fabbfef120ca6f796c2ad bisect_iv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/bisect_iv.c b/bisect_iv.c index e51bfcb..e5efb89 100644 --- a/bisect_iv.c +++ b/bisect_iv.c @@ -1304,8 +1304,10 @@ static void trace_seqnos(char *trace_orig, long long seqno_min, long long seqno_
res = seqno_trace_add(&trace_list, bat_node, seqno_event, print_trace);
- if (res < 1) + if (res < 1) { + hash_iterate_free(hashit); goto out; + } } } }