diff options
| author | Junio C Hamano <gitster@pobox.com> | 2023-02-24 22:54:01 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-02-24 22:54:01 -0800 |
| commit | f96dd8c3b56836c7aaac862f6bea92997680ebb7 (patch) | |
| tree | f3d78ae7fd6b8850d934a8b27524fd5f14ec96b0 | |
| parent | 6f581b6d6d17a0956f77d2f245a47ae9a2e76ae6 (diff) | |
| parent | 6eb095d78790d0d6cbad2186685dad4e7ba2e3de (diff) | |
| download | git-f96dd8c3b56836c7aaac862f6bea92997680ebb7.tar.xz | |
Merge branch 'ps/free-island-marks'
Fix on a previous fix already in 'master'.
* ps/free-island-marks:
delta-islands: fix segfault when freeing island marks
| -rw-r--r-- | delta-islands.c | 12 | ||||
| -rwxr-xr-x | t/t5319-multi-pack-index.sh | 16 |
2 files changed, 23 insertions, 5 deletions
diff --git a/delta-islands.c b/delta-islands.c index 8b234cb85b..afdec0a878 100644 --- a/delta-islands.c +++ b/delta-islands.c @@ -517,11 +517,13 @@ void free_island_marks(void) { struct island_bitmap *bitmap; - kh_foreach_value(island_marks, bitmap, { - if (!--bitmap->refcount) - free(bitmap); - }); - kh_destroy_oid_map(island_marks); + if (island_marks) { + kh_foreach_value(island_marks, bitmap, { + if (!--bitmap->refcount) + free(bitmap); + }); + kh_destroy_oid_map(island_marks); + } /* detect use-after-free with a an address which is never valid: */ island_marks = (void *)-1; diff --git a/t/t5319-multi-pack-index.sh b/t/t5319-multi-pack-index.sh index b5f9b10922..499d5d4c78 100755 --- a/t/t5319-multi-pack-index.sh +++ b/t/t5319-multi-pack-index.sh @@ -1015,4 +1015,20 @@ test_expect_success 'complains when run outside of a repository' ' grep "not a git repository" err ' +test_expect_success 'repack with delta islands' ' + git init repo && + test_when_finished "rm -fr repo" && + ( + cd repo && + + test_commit first && + git repack && + test_commit second && + git repack && + + git multi-pack-index write && + git -c repack.useDeltaIslands=true multi-pack-index repack + ) +' + test_done |
