From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 589CDC433F5 for ; Thu, 7 Oct 2021 22:47:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2C7F661077 for ; Thu, 7 Oct 2021 22:47:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240076AbhJGWsy (ORCPT ); Thu, 7 Oct 2021 18:48:54 -0400 Received: from pb-smtp21.pobox.com ([173.228.157.53]:58413 "EHLO pb-smtp21.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229778AbhJGWsx (ORCPT ); Thu, 7 Oct 2021 18:48:53 -0400 Received: from pb-smtp21.pobox.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 4B852164A8D; Thu, 7 Oct 2021 18:46:59 -0400 (EDT) (envelope-from junio@pobox.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; s=sasl; bh=z+UKnbKEh9N+ SpfCiMXLe6/FgTAJ4dbb5QkSndm0lME=; b=bEw3ZwUkXErkjD3VKEZtV+6akP4J PmSCJKN1y0Dh+wb5+NrGlsLiYDd5GvbdHbYYB8L4hfEbX8mC0FJq9rUsAEfFeI21 cCRnN0ZrixuPPxFYoMiN7SthGthxEF5WiLk1+65KCpzoT96fnVnFPqiZyYZwEtyL BfK0DVJ41zmtrac= Received: from pb-smtp21.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 4490F164A8C; Thu, 7 Oct 2021 18:46:59 -0400 (EDT) (envelope-from junio@pobox.com) Received: from pobox.com (unknown [104.133.2.91]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp21.pobox.com (Postfix) with ESMTPSA id A64B5164A8A; Thu, 7 Oct 2021 18:46:56 -0400 (EDT) (envelope-from junio@pobox.com) From: Junio C Hamano To: =?utf-8?B?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason Cc: git@vger.kernel.org, Elijah Newren , Martin =?utf-8?Q?=C3=85gren?= , Andrzej Hunt , Jeff King Subject: Re: [PATCH v2 5/7] ls-files: fix a trivial dir_clear() leak References: Date: Thu, 07 Oct 2021 15:46:55 -0700 In-Reply-To: (=?utf-8?B?IsOGdmFyIEFybmZqw7Zyw7A=?= Bjarmason"'s message of "Thu, 7 Oct 2021 12:01:35 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 X-Pobox-Relay-ID: 797B20D8-27C0-11EC-A09D-98D80D944F46-77302942!pb-smtp21.pobox.com Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org =C3=86var Arnfj=C3=B6r=C3=B0 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=3Dtrue. 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.