Re: [PATCH 03/24] pack-bitmap: plug leak in find_objects()
- From
Jeff King <peff@peff.net>
- Date
- Dec 12, 2023, 07:04 UTC
- Message-ID
- <20231212070458.GB1117953@coredump.intra.peff.net>
- In-Reply-To
- <bc38fba65547f5716a2ff9904dd615e755ea84bb.1701198172.git.me@ttaylorr.com>
On Tue, Nov 28, 2023 at 02:08:02PM -0500, Taylor Blau wrote:
Show 7 quoted lines
> 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.
Show 8 quoted lines
> @@ -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