From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-4.3 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 9551C1F670 for ; Fri, 22 Oct 2021 00:16:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231629AbhJVASi (ORCPT ); Thu, 21 Oct 2021 20:18:38 -0400 Received: from pb-smtp20.pobox.com ([173.228.157.52]:54135 "EHLO pb-smtp20.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229512AbhJVASi (ORCPT ); Thu, 21 Oct 2021 20:18:38 -0400 Received: from pb-smtp20.pobox.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id 699E415150A; Thu, 21 Oct 2021 20:16:21 -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=KonDCeuO3SiE 6cJyM47+jJHcwlsT5WrivLv651QCYGQ=; b=qJ0fnTfutqWsl1gR+yNDh7qBH3GR Jr6DZFlmqHqWG6zh1pd6bwLBuaR76Yo8LF+9EplDfBY7sFyQILPz5cmXhhsw5Iqz LStADLVhVYztDolRWj3Ny1YTaJMWbm5QzzY+AoJxRve0cIVoUMIByg6rXHC/a2Lo waP9zYfdqaA5x2Q= Received: from pb-smtp20.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id 62342151509; Thu, 21 Oct 2021 20:16:21 -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-smtp20.pobox.com (Postfix) with ESMTPSA id 968F1151508; Thu, 21 Oct 2021 20:16:18 -0400 (EDT) (envelope-from junio@pobox.com) From: Junio C Hamano To: =?utf-8?B?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason Cc: git@vger.kernel.org, Jeff King , Taylor Blau Subject: Re: [PATCH 5/6] reflog: free() ref given to us by dwim_log() References: Date: Thu, 21 Oct 2021 17:16:17 -0700 In-Reply-To: (=?utf-8?B?IsOGdmFyCUFybmZqw7Zyw7A=?= Bjarmason"'s message of "Thu, 21 Oct 2021 17:57:36 +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: 473A3088-32CD-11EC-A017-F327CE9DA9D6-77302942!pb-smtp20.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: > When dwim_log() returns the "ref" is always ether NULL or an > xstrdup()'d string. > > Signed-off-by: =C3=86var Arnfj=C3=B6r=C3=B0 Bjarmason > --- > builtin/reflog.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/builtin/reflog.c b/builtin/reflog.c > index bd4c669918d..175c83e7cc2 100644 > --- a/builtin/reflog.c > +++ b/builtin/reflog.c > @@ -653,6 +653,7 @@ static int cmd_reflog_expire(int argc, const char *= *argv, const char *prefix) > should_expire_reflog_ent, > reflog_expiry_cleanup, > &cb); > + free(ref); OK. When dwim_log() returns false, it would not have touched &ref at all, so the "continue" (not shown in the context above) is not leaking, and this loop looks good. Thanks. > } > return status; > }