diff options
author | Patrick Steinhardt <ps@pks.im> | 2024-09-30 11:14:08 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-09-30 20:23:08 +0200 |
commit | 2f0ee051ddaf880daac06773b56f077c4012a1c7 (patch) | |
tree | fc3c5fec8787558ab90bf13c311f7658f4e38068 /t/t5327-multi-pack-bitmaps-rev.sh | |
parent | revision: fix leaking saved parents (diff) | |
download | git-2f0ee051ddaf880daac06773b56f077c4012a1c7.tar.xz git-2f0ee051ddaf880daac06773b56f077c4012a1c7.zip |
pack-write: fix return parameter of `write_rev_file_order()`
While the return parameter of `write_rev_file_order()` is a string
constant, the function may indeed return an allocated string when its
first parameter is a `NULL` pointer. This makes for a confusing calling
convention, where callers need to be aware of these intricate ownership
rules and cast away the constness to free the string in some cases.
Adapt the function and its caller `write_rev_file()` to always return an
allocated string and adapt callers to always free the return value.
Note that this requires us to also adapt `rename_tmp_packfile()`, which
compares the pointers to packfile data with each other. Now that the
path of the reverse index file gets allocated unconditionally the check
will always fail. This is fixed by using strcmp(3P) instead, which also
feels way less fragile.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5327-multi-pack-bitmaps-rev.sh')
-rwxr-xr-x | t/t5327-multi-pack-bitmaps-rev.sh | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/t/t5327-multi-pack-bitmaps-rev.sh b/t/t5327-multi-pack-bitmaps-rev.sh index 9cac03a94b..994a8e6be4 100755 --- a/t/t5327-multi-pack-bitmaps-rev.sh +++ b/t/t5327-multi-pack-bitmaps-rev.sh @@ -2,6 +2,7 @@ test_description='exercise basic multi-pack bitmap functionality (.rev files)' +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh . "${TEST_DIRECTORY}/lib-bitmap.sh" |