hash-object: fix a trivial leak in --path
commitd17294a05e7601b5139e09609fd0f805ac78271b
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Sat, 5 Feb 2022 00:04:29 +0000 (5 01:04 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 7 Feb 2022 01:55:55 +0000 (6 17:55 -0800)
tree2cbffed02e438fd5133bcef92da97af1bd5c4aa9
parent4c53a8c20f8984adb226293a3ffd7b88c3f4ac1a
hash-object: fix a trivial leak in --path

Fix a memory leak that happened when the --path option was
provided. This leak has been with us ever since the option was added
in 39702431500 (add --path option to git hash-object, 2008-08-03).

We can now mark "t1007-hash-object.sh" as passing when git is compiled
with SANITIZE=leak. It'll now run in the the
"GIT_TEST_PASSING_SANITIZE_LEAK=true" test mode (the "linux-leaks" CI
target).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/hash-object.c
t/t1007-hash-object.sh