From patchwork Fri Oct 7 15:08:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ren=C3=A9_Scharfe?= X-Patchwork-Id: 13001192 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 439ADC433FE for ; Fri, 7 Oct 2022 15:08:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229900AbiJGPIv (ORCPT ); Fri, 7 Oct 2022 11:08:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229799AbiJGPIt (ORCPT ); Fri, 7 Oct 2022 11:08:49 -0400 Received: from mout.web.de (mout.web.de [212.227.15.4]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E81A510251D for ; Fri, 7 Oct 2022 08:08:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1665155323; bh=UsO7KqI/PPvZQ7qWfdnDGIBdpB+PlzAu4YYJnuDxXuw=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=mltmjTzwFFxtrc8cX2e2YdbgaQWG8ypSap8iDHM+mUr2uRFHugtvRhhOLAWjz5/d4 SgQrN8AC8koQrST4LxpOsrixSOKHcBiJyXw2Tm0J/UdChBldu8hmErKztrlHgqb2Qa Dw+1TOl/TDBZ2nEq2lmPLwObAs/Hz9EFFPk8tbfs0zRotd8+4JeHXcqpLxjIMwbjG0 5Xt9DlIY+ulu0ExD0B9DyGmIeTNgK8barKaTntaknUUlQgvgOIL5Mt4KvkS9KVXRjT bDSmjeLcb/mUXpaAfSR3lDJ94AnpTCLQle1OFUqtvGUa5WxRBvM3lzVUtoqrGDYUKm qlRXpGJjN6DnQ== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.29] ([79.203.23.161]) by smtp.web.de (mrweb006 [213.165.67.108]) with ESMTPSA (Nemesis) id 1MSIJA-1oaCAN1cK0-00Swhr; Fri, 07 Oct 2022 17:08:43 +0200 Message-ID: <1965b54b-122a-c965-f886-1a7dd6afbfb4@web.de> Date: Fri, 7 Oct 2022 17:08:42 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: [PATCH v2] bisect--helper: plug strvec leak To: Junio C Hamano , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Cc: Git List References: <5c6a4c30-d454-51b6-ec57-9af036b9c4e0@web.de> <221005.8635c2u3k5.gmgdl@evledraar.gmail.com> <221006.86a668r5mf.gmgdl@evledraar.gmail.com> Content-Language: en-US From: =?utf-8?q?Ren=C3=A9_Scharfe?= In-Reply-To: X-Provags-ID: V03:K1:qNssRt9mXdV+mRUqxAo68BYUxRcrn2GiDS+nffwBcYazUU6S6+T 8bt8QYfq4ILymjpqUhLvjryCHU3dnZrGnPvlK5uERQ1MKFbaM44n9eh1VjIJV6rBh6T1LL6 EZohbmrnh8DlxxF39FtJBZuKB+Dzy7KYaC6tXOM2fkmqsATvIqWc/x8Y4mEQefsFFHJnUoh A0YeyJ6qFQx6tFdsCLZGw== X-UI-Out-Filterresults: notjunk:1;V03:K0:lbZPQIREsH8=:VLB2xuXD8aU0/EqYH9SlJH FY2EgzMT7kED57JY0VCSEcTIGVeMvFrv7JTWVnBh0IvRqgBSsqvq6fCvVwoi4z9GbIUvpzJIz RWNXTb3TQO2CXo6Y0GkHr4LZY7fvjKO/CmUl4tY8js19Xw1WodXUMENJF+G8FfY6PtEGiOjC8 pWcubZNBPufF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RQ9qrJ8aGxTPc xf05OGrIPqo/mDW7m6z8wbFBtCtU7WEZi4F0SQLC1VobgQyn/mhkEYOJrb1jDqMOXHNe5uSXJ wu4d6c4KklABHM09r1qwlJfSVcHJxKX9H8RGFOk2CLeo5QPzS4F1cj2xj/SjM0FIl4trircZY M7+tUkxkYL+/NLENYxzgPgf11lCD7ce6Z8OfObBsj6hgU/yS9jXyFhajoFnWlN1gSi4jdy9hm tnfbusv7SmBrfZF/Yj3Y3AYZ0VTnCmALNRcrW8YPAHZumBMfRvntnVRS2QVCeUVa9u/TZQG9T 8WmrpclwA1fwnTUJSKnkroE1+xmFAZfV4EikMgJrtRniG Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The strvec "argv" is used to build a command for run_command_v_opt(), but never freed. Use a constant string array instead, which doesn't require any cleanup. Suggested-by: Ævar Arnfjörð Bjarmason Signed-off-by: René Scharfe --- builtin/bisect--helper.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) -- 2.38.0 diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 501245fac9..28ef7ec2a4 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -765,11 +765,10 @@ static enum bisect_error bisect_start(struct bisect_terms *terms, const char **a strbuf_read_file(&start_head, git_path_bisect_start(), 0); strbuf_trim(&start_head); if (!no_checkout) { - struct strvec argv = STRVEC_INIT; + const char *argv[] = { "checkout", start_head.buf, + "--", NULL }; - strvec_pushl(&argv, "checkout", start_head.buf, - "--", NULL); - if (run_command_v_opt(argv.v, RUN_GIT_CMD)) { + if (run_command_v_opt(argv, RUN_GIT_CMD)) { res = error(_("checking out '%s' failed." " Try 'git bisect start " "'."),