From: Junio C Hamano Date: Thu, 07 Oct 2021 22:46:55 GMT Subject: Re: [PATCH v2 5/7] ls-files: fix a trivial dir_clear() leak Message-ID: In-Reply-To: Ævar Arnfjörð Bjarmason writes: > 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.