]> Kevux Git Server - rit/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 1ef62c4..625c7d3 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 c3b08ac..471994c 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