]> git.ipfire.org Git - thirdparty/git.git/commit
commit-reach: fix memory leak in `ahead_behind()`
authorPatrick Steinhardt <ps@pks.im>
Mon, 27 May 2024 11:46:54 +0000 (13:46 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 27 May 2024 18:20:01 +0000 (11:20 -0700)
commitba9d029445e183d7c7dda75887cee1b5d6fee1d7
tree7909e0eedd9c7ca6d0ef60aa3d230cc3d47b530e
parent96c1655095ae21040afe9d9c05cf42bb0fc03581
commit-reach: fix memory leak in `ahead_behind()`

We use a priority queue in `ahead_behind()` to compute the ahead/behind
count for commits. We may not iterate through all commits part of that
queue though in case all of its entries are stale. Consequently, as we
never make the effort to release the remaining commits, we end up
leaking bit arrays that we have allocated for each of the contained
commits.

Plug this leak and mark the corresponding test as leak free.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
commit-reach.c
t/t3203-branch-output.sh