diff options
author | Patrick Steinhardt <ps@pks.im> | 2024-08-14 08:51:58 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-08-14 19:07:57 +0200 |
commit | aa9ef614dc281d123e8f18d19c9abecf82295c0e (patch) | |
tree | 78239faef7d90e6767e15cd6eca429137a53b416 /t/t1450-fsck.sh | |
parent | git: fix leaking system paths (diff) | |
download | git-aa9ef614dc281d123e8f18d19c9abecf82295c0e.tar.xz git-aa9ef614dc281d123e8f18d19c9abecf82295c0e.zip |
object-file: fix memory leak when reading corrupted headers
When reading corrupt object headers in `read_loose_object()`, we bail
out immediately. This causes a memory leak though because we would have
already initialized the zstream in `unpack_loose_header()`, and it is
the callers responsibility to finish the zstream even on error. While
this feels weird, other callsites do it correctly already.
Fix this leak by ending the zstream even on errors. We may want to
revisit this interface in the future such that the callee handles this
for us already when there was an error.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to '')
-rwxr-xr-x | t/t1450-fsck.sh | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh index 8a456b1142..280cbf3e03 100755 --- a/t/t1450-fsck.sh +++ b/t/t1450-fsck.sh @@ -6,6 +6,7 @@ test_description='git fsck random collection of tests * (main) A ' +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh test_expect_success setup ' |