]> git.ipfire.org Git - thirdparty/git.git/commitdiff
builtin/submodule--helper: fix leaking error buffer
authorPatrick Steinhardt <ps@pks.im>
Thu, 26 Sep 2024 11:46:14 +0000 (13:46 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 27 Sep 2024 15:25:34 +0000 (08:25 -0700)
Fix leaking error buffer when `compute_alternate_path()` fails.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/submodule--helper.c
t/t7408-submodule-reference.sh

index fd1b67940839f122b1500cb2a3030cf4bfb22e78..ff1376f69fcdeeacc1a404f5f64849f8d358fa61 100644 (file)
@@ -1621,6 +1621,8 @@ static int add_possible_reference_from_superproject(
                                ; /* nothing */
                        }
                }
+
+               strbuf_release(&err);
                strbuf_release(&sb);
        }
 
index d6040e0a33703310d52d588607e4f62912f0c049..7e1afa9ce470b14dc050eed0b23610b38b6a61bc 100755 (executable)
@@ -4,6 +4,8 @@
 #
 
 test_description='test clone --reference'
+
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 base_dir=$(pwd)