Message ID | bc38fba65547f5716a2ff9904dd615e755ea84bb.1701198172.git.me@ttaylorr.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | pack-objects: multi-pack verbatim reuse | expand |
On Tue, Nov 28, 2023 at 02:08:02PM -0500, Taylor Blau wrote: > The `find_objects()` function creates an object_list for any tips of the > reachability query which do not have corresponding bitmaps. > > The object_list is not used outside of `find_objects()`, but we never > free it with `object_list_free()`, resulting in a leak. Let's plug that > leak by calling `object_list_free()`, which results in t6113 becoming > leak-free. Makes sense. > @@ -1280,6 +1280,8 @@ static struct bitmap *find_objects(struct bitmap_index *bitmap_git, > base = fill_in_bitmap(bitmap_git, revs, base, seen); > } > > + object_list_free(¬_mapped); > + > return base; > } There's an extra return earlier in the function, but it triggers only when not_mapped is NULL. So this covers all cases. Good. > +++ b/t/t6113-rev-list-bitmap-filters.sh > [..] > +TEST_PASSES_SANITIZE_LEAK=true Yay. :) -Peff
diff --git a/pack-bitmap.c b/pack-bitmap.c index 0260890341..d2f1306960 100644 --- a/pack-bitmap.c +++ b/pack-bitmap.c @@ -1280,6 +1280,8 @@ static struct bitmap *find_objects(struct bitmap_index *bitmap_git, base = fill_in_bitmap(bitmap_git, revs, base, seen); } + object_list_free(¬_mapped); + return base; } diff --git a/t/t6113-rev-list-bitmap-filters.sh b/t/t6113-rev-list-bitmap-filters.sh index 86c70521f1..459f0d7412 100755 --- a/t/t6113-rev-list-bitmap-filters.sh +++ b/t/t6113-rev-list-bitmap-filters.sh @@ -4,6 +4,8 @@ test_description='rev-list combining bitmaps and filters' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-bitmap.sh +TEST_PASSES_SANITIZE_LEAK=true + test_expect_success 'set up bitmapped repo' ' # one commit will have bitmaps, the other will not test_commit one &&
The `find_objects()` function creates an object_list for any tips of the reachability query which do not have corresponding bitmaps. The object_list is not used outside of `find_objects()`, but we never free it with `object_list_free()`, resulting in a leak. Let's plug that leak by calling `object_list_free()`, which results in t6113 becoming leak-free. Signed-off-by: Taylor Blau <me@ttaylorr.com> --- pack-bitmap.c | 2 ++ t/t6113-rev-list-bitmap-filters.sh | 2 ++ 2 files changed, 4 insertions(+)