Thread (40 messages) 40 messages, 5 authors, 1d ago

Re: [PATCH 06/13] line-log: avoid redundant copy that leaks in process_ranges

From: Jeff King <hidden>
Date: 2026-07-01 08:02:26

On Wed, Jul 01, 2026 at 07:04:24AM +0000, Johannes Schindelin via GitGitGadget wrote:
From: Johannes Schindelin <redacted>

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help