Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2022-07-01 13:42:59 +0300
committerJunio C Hamano <gitster@pobox.com>2022-07-01 21:43:43 +0300
commit27472b5195e3e8e888be0fdc3a7a22687cd808fe (patch)
tree1b23edd76ac99711ace4cc3b6b8e5f3fa07d8514 /t/t5314-pack-cycle-detection.sh
parent55916bba0f4805a3bd0c1891c48effbfe1d12536 (diff)
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/t5314-pack-cycle-detection.sh')
-rwxr-xr-xt/t5314-pack-cycle-detection.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/t/t5314-pack-cycle-detection.sh b/t/t5314-pack-cycle-detection.sh
index 0aec8619e2..73a241743a 100755
--- a/t/t5314-pack-cycle-detection.sh
+++ b/t/t5314-pack-cycle-detection.sh
@@ -49,9 +49,9 @@ Then no matter which order we start looking at the packs in, we know that we
will always find a delta for "file", because its lookup will always come
immediately after the lookup for "dummy".
'
-. ./test-lib.sh
-
+TEST_PASSES_SANITIZE_LEAK=true
+. ./test-lib.sh
# Create a pack containing the tree $1 and blob $1:file, with
# the latter stored as a delta against $2:file.