summaryrefslogtreecommitdiff
path: root/t/t9301-fast-import-notes.sh
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2022-07-01 10:42:59 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-07-01 18:43:43 (GMT)
commit27472b5195e3e8e888be0fdc3a7a22687cd808fe (patch)
tree1b23edd76ac99711ace4cc3b6b8e5f3fa07d8514 /t/t9301-fast-import-notes.sh
parent55916bba0f4805a3bd0c1891c48effbfe1d12536 (diff)
downloadgit-27472b5195e3e8e888be0fdc3a7a22687cd808fe.zip
git-27472b5195e3e8e888be0fdc3a7a22687cd808fe.tar.gz
git-27472b5195e3e8e888be0fdc3a7a22687cd808fe.tar.bz2
cat-file: fix a common "struct object_context" memory leak
Fix a memory leak where "cat-file" will leak the "path" member. See e5fba602e59 (textconv: support for cat_file, 2010-06-15) for the code that introduced the offending get_oid_with_context() call (called get_sha1_with_context() at the time). As a result we can mark several tests as passing with SANITIZE=leak using "TEST_PASSES_SANITIZE_LEAK=true". As noted in dc944b65f1d (get_sha1_with_context: dynamically allocate oc->path, 2017-05-19) callers must free the "path" member. That same commit added the relevant free() to this function, but we weren't catching cases where we'd return early. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9301-fast-import-notes.sh')
-rwxr-xr-xt/t9301-fast-import-notes.sh1
1 files changed, 1 insertions, 0 deletions
diff --git a/t/t9301-fast-import-notes.sh b/t/t9301-fast-import-notes.sh
index 1ae4d7c..5841322 100755
--- a/t/t9301-fast-import-notes.sh
+++ b/t/t9301-fast-import-notes.sh
@@ -7,6 +7,7 @@ test_description='test git fast-import of notes objects'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh