Skip to content

Commit e861b09

Browse files
peffgitster
authored andcommitted
test-read-midx: fix leak of bitmap_index struct
In read_midx_preferred_pack(), we open the bitmap index but never free it. This isn't a big deal since this is just a test helper, and we exit immediately after, but since we're trying to keep our leak-checking tidy now, it's worth fixing. Signed-off-by: Jeff King <[email protected]> Acked-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 324efc9 commit e861b09

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

t/helper/test-read-midx.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,15 @@ static int read_midx_preferred_pack(const char *object_dir)
8585
return 1;
8686

8787
bitmap = prepare_bitmap_git(the_repository);
88-
if (!(bitmap && bitmap_is_midx(bitmap)))
88+
if (!bitmap)
8989
return 1;
90-
90+
if (!bitmap_is_midx(bitmap)) {
91+
free_bitmap_index(bitmap);
92+
return 1;
93+
}
9194

9295
printf("%s\n", midx->pack_names[midx_preferred_pack(bitmap)]);
96+
free_bitmap_index(bitmap);
9397
return 0;
9498
}
9599

0 commit comments

Comments
 (0)