Re: [PATCH v2 5/7] ls-files: fix a trivial dir_clear() leak
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 7, 2021, 22:46 UTC
- Message-ID
- <xmqqily8o3kw.fsf@gitster.g>
- In-Reply-To
- <patch-v2-5.7-73cf1018953-20211007T100014Z-avarab@gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 6 quoted lines
> This does add a bit of complexity, but I think it's worth it to just > fix these leaks when it's easy in built-ins. It allows them to serve > as canaries for underlying APIs that shouldn't be leaking, it > encourages us to make those freeing APIs nicer for all their users, > and it prevents other leaking regressions by being able to mark the > entire test as TEST_PASSES_SANITIZE_LEAK=true.
This does more than necessary, though. Introducing "ret", replacing an early return with an assignment to it, and returning "ret" instead of hardcoded 0, would have been the "fix a trivial leak", and the "ah, report_path_error() always returns true" does not belong here.
These things look small, but small things add up.