Skip to content

Commit 61f8bb1

Browse files
pks-tgitster
authored andcommitted
builtin/rev-list: fix leaking bitmap index when calculating disk usage
git-rev-list(1) can speed up its object size calculations for reachable objects via a bitmap walk, if there is any bitmap. This is done in `try_bitmap_disk_usage()`, which tries to optimistically load the bitmap and then use it, if available. It never frees it though, leading to a memory leak. Fix this. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f644dc8 commit 61f8bb1

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

builtin/rev-list.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,8 @@ static int try_bitmap_disk_usage(struct rev_info *revs,
508508

509509
size_from_bitmap = get_disk_usage_from_bitmap(bitmap_git, revs);
510510
print_disk_usage(size_from_bitmap);
511+
512+
free_bitmap_index(bitmap_git);
511513
return 0;
512514
}
513515

t/t6115-rev-list-du.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/bin/sh
22

33
test_description='basic tests of rev-list --disk-usage'
4+
5+
TEST_PASSES_SANITIZE_LEAK=true
46
. ./test-lib.sh
57

68
# we want a mix of reachable and unreachable, as well as

0 commit comments

Comments
 (0)