commit-reach: simplify cleanup of remaining bitmaps in ahead_behind ()

Don't bother extracting the last few remaining prio_queue items in order when we only want to free their associated bitmaps; just iterate over the item array. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

René Scharfe committed Mar 19, 2026 at 17:24 UTC 60d8b5af9b553230faaae4fd276398d4f9fe4e39
1 file changed +2 -4
commit-reach.c
+2 -4
@@ -1117,10 +1117,8 @@ void ahead_behind(struct repository *r,
1117
1118 /* STALE is used here, PARENT2 is used by insert_no_dup(). */
1119 repo_clear_commit_marks(r, PARENT2 | STALE);
1120 - while (prio_queue_peek(&queue)) {
1121 - struct commit *c = prio_queue_get(&queue);
1122 - free_bit_array(c);
1123 - }
1120 + for (size_t i = 0; i < queue.nr; i++)
1121 + free_bit_array(queue.array[i].data);
1122 clear_bit_arrays(&bit_arrays);
1123 clear_prio_queue(&queue);
1124 }