Re: [PATCH 06/13] line-log: avoid redundant copy that leaks in process_ranges
- From
Jeff King <peff@peff.net>
- Date
- Jul 1, 2026, 08:02 UTC
- Message-ID
- <20260701080224.GA813310@coredump.intra.peff.net>
- In-Reply-To
- <5a6b17f075ca2d0442d512a0021557aa112860fc.1782889472.git.gitgitgadget@gmail.com>
On Wed, Jul 01, 2026 at 07:04:24AM +0000, Johannes Schindelin via GitGitGadget wrote:
Show 15 quoted lines
> From: Johannes Schindelin <johannes.schindelin@gmx.de> > > When bloom_filter_check() indicates that a commit does not touch > any of the tracked paths, line_log_process_ranges_arbitrary_commit() > propagates the current ranges to the parent by calling > line_log_data_copy() and passing the copy to add_line_range(). > However, add_line_range() always makes its own copy internally > (via line_log_data_copy or line_log_data_merge), so the caller's > copy is never freed and leaks every time this path is taken. > > Pass range directly to add_line_range() instead of making a > redundant intermediate copy. The callee's internal copy handles > ownership correctly. > > Pointed out by Coverity.
Heh, I just posted the identical patch (in my case found by running the test suite with GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=1).
So yeah, looks good to me. :)
-Peff