diff mbox series

[16/23] pack-bitmap-write: fix leaking OID array

Message ID 98228243be04d7ab296ccf7516e092549bbd1236.1727687410.git.ps@pks.im (mailing list archive)
State Accepted
Commit 7f97266ee15d2a30dbc12c9a7f282a9f94b32476
Headers show
Series Memory leak fixes (pt.8) | expand

Commit Message

Patrick Steinhardt Sept. 30, 2024, 9:13 a.m. UTC
Fix a leaking OID array in `write_pseudo_merges()`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 pack-bitmap-write.c             | 1 +
 t/t5333-pseudo-merge-bitmaps.sh | 1 +
 2 files changed, 2 insertions(+)

Comments

Taylor Blau Sept. 30, 2024, 9:22 p.m. UTC | #1
On Mon, Sep 30, 2024 at 11:13:58AM +0200, Patrick Steinhardt wrote:
> diff --git a/t/t5333-pseudo-merge-bitmaps.sh b/t/t5333-pseudo-merge-bitmaps.sh
> index 1dd6284756..eca4a1eb8c 100755
> --- a/t/t5333-pseudo-merge-bitmaps.sh
> +++ b/t/t5333-pseudo-merge-bitmaps.sh
> @@ -4,6 +4,7 @@ test_description='pseudo-merge bitmaps'
>
>  GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP=0
>
> +TEST_PASSES_SANITIZE_LEAK=true
>  . ./test-lib.sh

Very nicely done :-).

Thanks,
Taylor
diff mbox series

Patch

diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c
index 6413dd1731..49758e2525 100644
--- a/pack-bitmap-write.c
+++ b/pack-bitmap-write.c
@@ -913,6 +913,7 @@  static void write_pseudo_merges(struct bitmap_writer *writer,
 	for (i = 0; i < writer->pseudo_merges_nr; i++)
 		bitmap_free(commits_bitmap[i]);
 
+	oid_array_clear(&commits);
 	free(pseudo_merge_ofs);
 	free(commits_bitmap);
 }
diff --git a/t/t5333-pseudo-merge-bitmaps.sh b/t/t5333-pseudo-merge-bitmaps.sh
index 1dd6284756..eca4a1eb8c 100755
--- a/t/t5333-pseudo-merge-bitmaps.sh
+++ b/t/t5333-pseudo-merge-bitmaps.sh
@@ -4,6 +4,7 @@  test_description='pseudo-merge bitmaps'
 
 GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP=0
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_pseudo_merges () {