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 --- bisect_iv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/bisect_iv.c b/bisect_iv.c index e9e7326..7105c78 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; + } } } }