]> git.ipfire.org Git - thirdparty/git.git/commitdiff
midx-write: fix leaking buffer
authorPatrick Steinhardt <ps@pks.im>
Mon, 30 Sep 2024 09:14:01 +0000 (11:14 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 30 Sep 2024 18:23:07 +0000 (11:23 -0700)
The buffer used to compute the final MIDX name is never released. Plug
this memory leak.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
midx-write.c
t/t5334-incremental-multi-pack-index.sh

index 1ef62c4f4bebf6b837b015d97f28e3dda359725c..625c7d31371201150c8a6a87a60f9f9ec1e9856b 100644 (file)
@@ -1445,6 +1445,8 @@ static int write_midx_internal(const char *object_dir,
                        return -1;
                }
 
+               strbuf_release(&final_midx_name);
+
                keep_hashes[ctx.num_multi_pack_indexes_before] =
                        xstrdup(hash_to_hex(midx_hash));
 
index c3b08acc733d9419e302b1cc46261ddda7e93ee0..471994c4bc89d8faa5bb39e8614439573f388ba3 100755 (executable)
@@ -1,6 +1,8 @@
 #!/bin/sh
 
 test_description='incremental multi-pack-index'
+
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-midx.sh