Skip to content

Commit f96dd8c

Browse files
committed
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
2 parents 6f581b6 + 6eb095d commit f96dd8c

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

delta-islands.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -517,11 +517,13 @@ void free_island_marks(void)
517517
{
518518
struct island_bitmap *bitmap;
519519

520-
kh_foreach_value(island_marks, bitmap, {
521-
if (!--bitmap->refcount)
522-
free(bitmap);
523-
});
524-
kh_destroy_oid_map(island_marks);
520+
if (island_marks) {
521+
kh_foreach_value(island_marks, bitmap, {
522+
if (!--bitmap->refcount)
523+
free(bitmap);
524+
});
525+
kh_destroy_oid_map(island_marks);
526+
}
525527

526528
/* detect use-after-free with a an address which is never valid: */
527529
island_marks = (void *)-1;

t/t5319-multi-pack-index.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,4 +1015,20 @@ test_expect_success 'complains when run outside of a repository' '
10151015
grep "not a git repository" err
10161016
'
10171017

1018+
test_expect_success 'repack with delta islands' '
1019+
git init repo &&
1020+
test_when_finished "rm -fr repo" &&
1021+
(
1022+
cd repo &&
1023+
1024+
test_commit first &&
1025+
git repack &&
1026+
test_commit second &&
1027+
git repack &&
1028+
1029+
git multi-pack-index write &&
1030+
git -c repack.useDeltaIslands=true multi-pack-index repack
1031+
)
1032+
'
1033+
10181034
test_done

0 commit comments

Comments
 (0)