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: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by dcvr.yhbt.net (Postfix) with ESMTP id D53F41F54E for ; Fri, 29 Jul 2022 19:00:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238291AbiG2TAo (ORCPT ); Fri, 29 Jul 2022 15:00:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238213AbiG2TAn (ORCPT ); Fri, 29 Jul 2022 15:00:43 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 318784F1A4 for ; Fri, 29 Jul 2022 12:00:41 -0700 (PDT) Received: (qmail 22109 invoked by uid 109); 29 Jul 2022 19:00:41 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Fri, 29 Jul 2022 19:00:41 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 27803 invoked by uid 111); 29 Jul 2022 19:00:41 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Fri, 29 Jul 2022 15:00:41 -0400 Authentication-Results: peff.net; auth=none Date: Fri, 29 Jul 2022 15:00:40 -0400 From: Jeff King To: =?utf-8?B?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason Cc: git@vger.kernel.org, Junio C Hamano Subject: Re: [PATCH v2 6/6] revisions API: don't leak memory on argv elements that need free()-ing Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Fri, Jul 29, 2022 at 10:31:08AM +0200, Ævar Arnfjörð Bjarmason wrote: > Add a "free_removed_argv_elements" member to "struct > setup_revision_opt", and use it to fix several memory leaks, e.g. the > one with a "XXX" comment added in 8a534b61241 (bisect: use argv_array > API, 2011-09-13). I think the mention of this "XXX" comment is a little misleading. That comment is not talking about leaking the "--" entry. It is talking about leaking the _entire_ strvec, because of memory-lifetime issues. And we fixed those already in 5. It's a small point, and the code here is fine. But if you take my suggested replacement for 5, then it becomes even more nonsensical. ;) -Peff