From patchwork Wed Jan 18 16:09:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 13106641 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 ADF3DC32793 for ; Wed, 18 Jan 2023 16:14:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230271AbjARQOL (ORCPT ); Wed, 18 Jan 2023 11:14:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229844AbjARQNf (ORCPT ); Wed, 18 Jan 2023 11:13:35 -0500 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87B3730291 for ; Wed, 18 Jan 2023 08:09:28 -0800 (PST) Received: by mail-ej1-x630.google.com with SMTP id ud5so84471579ejc.4 for ; Wed, 18 Jan 2023 08:09:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VVTsF1YvHVZQ6LaAVYrS8xmFanWi5QI72DX8NIwv4NQ=; b=RpCzk5eV9zUVa9PynRhUCPj3pfdfFbejK3aKhsdVHhGV+jzS2f93fAoLf2rCNJHtvK NpacCPWK8f0GpEJAtKwDzGFud+T3Ppa1vozNzTccFpE6SBJPl+Lvkkiad9c3hjvYRREJ 9DbCVhImvtu0FdZ26Kho0KF08s2wiZ0en5Zh9kfI/MSGuyleKNXB1TLnlAyzW31V77dc OxDEvjVbkjACcyr8sMB6x5VngDuhhlOjtb4bBsetFFOw8hgNsbz6IThyRNYKsaKN7HFC erSq8yAyNLZc9mbEwXdVuRfPuHk5t56UgChgFtOufbKkzRW+qTDAk99hxaReUl1E7zLu XHww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VVTsF1YvHVZQ6LaAVYrS8xmFanWi5QI72DX8NIwv4NQ=; b=eFx5mZwOXzhYkEjJ7Qwhrib+UpLMa9GZ+92KrgvShr8MwO5Lk0KdR1JIppL8AjaoiU pT0VGDt4YTb7IcptzpVtiWJDr729uOQG7n8YTp6AX5JU/8CjwnJDQGk22gVOnBs8tpPp f8tbOj9EQniEn8afMsD9y1Y4rsCvyVkEGMHCzH8SR/wBA4irQ3iB3TW/zmMG73D4TqIm 2JuIUn9aTtxvZ9dlGp2jxQTrEg80+qJABdcTlni0Lf3QR/1a9hqj+a2BU2FmqK8aZG0w DXlPkGbj2bpGDREXHZ4RAi4zzOzctdLQ0J3u8ML2ojNNNK9/gtuLyx8JAaPnkzC8KoS4 m/qQ== X-Gm-Message-State: AFqh2kp50mK+h2SDvQYM4f+256/auiWtCSLB8lfmvnW2w6xs5gXvcueo z/g8HLcj6fTy2Iqq+uRW/fL+BECQNdXADQ== X-Google-Smtp-Source: AMrXdXtP2niRejT/+q0e4JYcGG6rNAPL1tS/fIcx7+F/ub6xYR6kf8St9F35AmW2QvhF9e0+VZ6+JA== X-Received: by 2002:a17:907:7424:b0:872:a754:da73 with SMTP id gj36-20020a170907742400b00872a754da73mr6189114ejc.63.1674058166615; Wed, 18 Jan 2023 08:09:26 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id du1-20020a17090772c100b0084bfd56fb3bsm14778202ejc.162.2023.01.18.08.09.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 08:09:26 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Phillip Wood , Johannes Schindelin , Junio C Hamano , Taylor Blau , =?utf-8?q?Ren=C3=A9_Scharfe?= , =?utf-8?b?w4Z2YXIgQXJuZmo=?= =?utf-8?b?w7Zyw7AgQmphcm1hc29u?= Subject: [PATCH v3 1/8] rebase: use "cleanup" pattern in do_interactive_rebase() Date: Wed, 18 Jan 2023 17:09:09 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.1225.g30a3d88132d In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Use a "goto cleanup" pattern in do_interactive_rebase(). This eliminates some duplicated free() code added in 53bbcfbde7c (rebase -i: implement the main part of interactive rebase as a builtin, 2018-09-27), and sets us up for a subsequent commit which'll make further use of the "cleanup" label. Signed-off-by: Ævar Arnfjörð Bjarmason --- builtin/rebase.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/builtin/rebase.c b/builtin/rebase.c index 1481c5b6a5b..7141fd5e0c1 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -256,7 +256,7 @@ static void split_exec_commands(const char *cmd, struct string_list *commands) static int do_interactive_rebase(struct rebase_options *opts, unsigned flags) { - int ret; + int ret = -1; char *revisions = NULL, *shortrevisions = NULL; struct strvec make_script_args = STRVEC_INIT; struct todo_list todo_list = TODO_LIST_INIT; @@ -265,16 +265,12 @@ static int do_interactive_rebase(struct rebase_options *opts, unsigned flags) if (get_revision_ranges(opts->upstream, opts->onto, &opts->orig_head->object.oid, &revisions, &shortrevisions)) - return -1; + goto cleanup; if (init_basic_state(&replay, opts->head_name ? opts->head_name : "detached HEAD", - opts->onto, &opts->orig_head->object.oid)) { - free(revisions); - free(shortrevisions); - - return -1; - } + opts->onto, &opts->orig_head->object.oid)) + goto cleanup; if (!opts->upstream && opts->squash_onto) write_file(path_squash_onto(), "%s\n", @@ -304,6 +300,7 @@ static int do_interactive_rebase(struct rebase_options *opts, unsigned flags) opts->autosquash, opts->update_refs, &todo_list); } +cleanup: string_list_clear(&commands, 0); free(revisions); free(shortrevisions); From patchwork Wed Jan 18 16:09:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 13106642 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 03697C38147 for ; Wed, 18 Jan 2023 16:14:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230272AbjARQOO (ORCPT ); Wed, 18 Jan 2023 11:14:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230176AbjARQNf (ORCPT ); Wed, 18 Jan 2023 11:13:35 -0500 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30361303CD for ; Wed, 18 Jan 2023 08:09:29 -0800 (PST) Received: by mail-ej1-x62a.google.com with SMTP id hw16so72571558ejc.10 for ; Wed, 18 Jan 2023 08:09:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vYvVtEoD6GitywXnzu9tpBWlTpwNmt44MW+zTf4CMYU=; b=fFq6SO9rBHbxpqUnSsXjvLU0jNoxRvU9GQuyo922uDey/JM7hEjKEHwJk6KTQRNvef t/X/+vgrngw90CNYGnajAcctX+CdFthYdW16FfJBM0DeOaYL+HN2Tsal5wupCEbAzEeB F6YvnGPx/QBeR6ejY5i7cFR9hTZzTqf0cE/uye3Kv4Z8NoobH1lm5ZYJbF/SyA8Ey3YV 3/Seyyidcow9CXqpCcl5G+Eq4sdKW344VPeXj7m/r9QhFJmYgZC+QesGWXJcYBpR8sfu U3rIgGHzk0mf8WH/qzT1MIO580nWQl6LkCm2F79YaYa5Ko3Nm14Rwme166L9VNZfySqQ atuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vYvVtEoD6GitywXnzu9tpBWlTpwNmt44MW+zTf4CMYU=; b=Keb/DX537PFuI8HhHKlBHseBkwa6SOiE//9BU+hv7u0xgUI22l4aN2h4s2md8sndTV AWHHR+zfIVCDdwDftKpq9o77dLJO1/tlzIrzly6aeIpFGDLjIFfoN3siF18gq5nPnraU WQ2eMGEL/sMJOvvZgneXxtsex+qrlsF8sD9A5PIXzVmutsofHbCFv2KNK2q/bok1JEKS aloopib3ayDtR9d0AaSa8Xm4/s7TzXkOPzM7dlo8Smn7cCH2z9n2jLhPb738Os+BGP/8 4BYgOhcLaEqZq8Je8k4fdHYSmxnXd2Ajl4xxQqW0pQQfG1OIo97IuppoGXvgEnq/gsor XcUA== X-Gm-Message-State: AFqh2kpuokoNxKHophirGGLUpK0k79nFrU9QAspgQziZ8m43Nmdxg5r7 O5yUz22n1fst3grEZz70GXqD5oj04ietzA== X-Google-Smtp-Source: AMrXdXtjK6L3euyD/qK5QWmaBYZ24Z9YhRISOnP8k1aaqMJFEdNJ+R+ehkwBJRd30Emh8uWiifNZAQ== X-Received: by 2002:a17:906:762a:b0:7c0:be5d:59a9 with SMTP id c10-20020a170906762a00b007c0be5d59a9mr20295410ejn.20.1674058167455; Wed, 18 Jan 2023 08:09:27 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id du1-20020a17090772c100b0084bfd56fb3bsm14778202ejc.162.2023.01.18.08.09.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 08:09:26 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Phillip Wood , Johannes Schindelin , Junio C Hamano , Taylor Blau , =?utf-8?q?Ren=C3=A9_Scharfe?= , =?utf-8?b?w4Z2YXIgQXJuZmo=?= =?utf-8?b?w7Zyw7AgQmphcm1hc29u?= Subject: [PATCH v3 2/8] sequencer.c: split up sequencer_remove_state() Date: Wed, 18 Jan 2023 17:09:10 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.1225.g30a3d88132d In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Split off the free()-ing in sequencer_remove_state() into a utility function, which will be adjusted and called independent of the other code in sequencer_remove_state() in a subsequent commit. The only functional change here is changing the "int" to a "size_t", which is the correct type, as "xopts_nr" is a "size_t". Signed-off-by: Ævar Arnfjörð Bjarmason --- sequencer.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/sequencer.c b/sequencer.c index bcb662e23be..d385bea2bed 100644 --- a/sequencer.c +++ b/sequencer.c @@ -351,10 +351,22 @@ static const char *gpg_sign_opt_quoted(struct replay_opts *opts) return buf.buf; } +static void replay_opts_release(struct replay_opts *opts) +{ + free(opts->gpg_sign); + free(opts->reflog_action); + free(opts->default_strategy); + free(opts->strategy); + for (size_t i = 0; i < opts->xopts_nr; i++) + free(opts->xopts[i]); + free(opts->xopts); + strbuf_release(&opts->current_fixups); +} + int sequencer_remove_state(struct replay_opts *opts) { struct strbuf buf = STRBUF_INIT; - int i, ret = 0; + int ret = 0; if (is_rebase_i(opts) && strbuf_read_file(&buf, rebase_path_refs_to_delete(), 0) > 0) { @@ -373,14 +385,7 @@ int sequencer_remove_state(struct replay_opts *opts) } } - free(opts->gpg_sign); - free(opts->reflog_action); - free(opts->default_strategy); - free(opts->strategy); - for (i = 0; i < opts->xopts_nr; i++) - free(opts->xopts[i]); - free(opts->xopts); - strbuf_release(&opts->current_fixups); + replay_opts_release(opts); strbuf_reset(&buf); strbuf_addstr(&buf, get_dir(opts)); From patchwork Wed Jan 18 16:09:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 13106643 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 1D698C32793 for ; Wed, 18 Jan 2023 16:14:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230371AbjARQOQ (ORCPT ); Wed, 18 Jan 2023 11:14:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230203AbjARQNf (ORCPT ); Wed, 18 Jan 2023 11:13:35 -0500 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 071EB1CADF for ; Wed, 18 Jan 2023 08:09:30 -0800 (PST) Received: by mail-ej1-x62a.google.com with SMTP id tz11so20022728ejc.0 for ; Wed, 18 Jan 2023 08:09:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=s5x3CiWLtjCe9AxClWGJcOTvIyutOqaL4FHgVZN17kw=; b=kN74XAF95Q9ZVJ1mbjOQsNwF0Sy2QrvYOGmgFei3CaeL//dGn46rortjHJwOm2NvSm ArEsD1g7dPNdWneMGvYtHAliT50L5FBLIpMQYdHk/0xla8F/arzgeDm9zypkxKn6nx7e HUX+6TG++I1MIiHqY2SggHGRGKpzFL3yxxjfbI+6KDLmq4EqZ4TA5WoKWE/TloPu9sFJ ygVo8i+G4vkbgE4zpzpaulkUmKH86qjk1EaGMg3HygnWZvB825Sec2Cmh10HkyRMD6Cj Qri64zeau0v4jp2Yy1O4L3N+2eXAvX/5p2OULeGsKsFijtkZvZk5PqwKu1l2DxqV+0zb aViQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=s5x3CiWLtjCe9AxClWGJcOTvIyutOqaL4FHgVZN17kw=; b=T20pQca5rUSYN2LEKZHo0WSbdqutQChnkFAyan8F1xH9gQa1PDBE+P4mhy9fnO0C4/ 73yTpXx6o/1zByk0uRh6fg9EdYx9gkXqLb6a0ZDUgXmD4ZMFvhM6xfMq37yEDYsEAvVq Znv4Yiu3BBzzeRL5RJGMyN3ozGUb60t8swTLq/wKI7D6oVBQJh57LWhei4JaTYadB/Cw v7aX+cnYlS+2OZe1GIcpmW7+25sy867PMR+Sli5ubB93fPPlQQrErTtHaM41wBRrrJQn ZbOnTFMkj2QMblgLar53dvcdsWmBofoq5/Z9Md1bgekp3qv0DkQBuqRyDhkYRlI+LMJ9 ctuQ== X-Gm-Message-State: AFqh2kpd+wrM2REyJx9BX6760un46B9HC0BuLeU7cocOlGVnUPlh2YtL xe7gUZRoGACONQXDmGhJWemnZpwr0mowjg== X-Google-Smtp-Source: AMrXdXtPFArztsEpUfB4+36EH40KchuH+E5e3heFEKAIL20XA/JKG6Zl6pPdYsdceKil6+mvzAYqQQ== X-Received: by 2002:a17:906:fc0e:b0:84d:3fa7:12d7 with SMTP id ov14-20020a170906fc0e00b0084d3fa712d7mr7115799ejb.21.1674058168224; Wed, 18 Jan 2023 08:09:28 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id du1-20020a17090772c100b0084bfd56fb3bsm14778202ejc.162.2023.01.18.08.09.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 08:09:27 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Phillip Wood , Johannes Schindelin , Junio C Hamano , Taylor Blau , =?utf-8?q?Ren=C3=A9_Scharfe?= , =?utf-8?b?w4Z2YXIgQXJuZmo=?= =?utf-8?b?w7Zyw7AgQmphcm1hc29u?= Subject: [PATCH v3 3/8] rebase & sequencer API: fix get_replay_opts() leak in "rebase" Date: Wed, 18 Jan 2023 17:09:11 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.1225.g30a3d88132d In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Make the recently added replay_opts_release() function non-static and use it for freeing the "struct replay_opts" constructed by the get_replay_opts() function in "builtin/rebase.c". See [1] for the initial addition of get_replay_opts(). To safely call our new replay_opts_release() we'll need to stop calling it in sequencer_remove_state(), and instead call it where we allocate the "struct replay_opts" itself. This is because in e.g. do_interactive_rebase() we construct a "struct replay_opts" with "get_replay_opts()", and then call "complete_action()". If we get far enough in that function without encountering errors we'll call "pick_commits()" which (indirectly) calls sequencer_remove_state() at the end. But if we encounter errors anywhere along the way we'd punt out early, and not free() the memory we allocated. Remembering whether we previously called sequencer_remove_state() would be a hassle. Using a FREE_AND_NULL() pattern would also work, as it would be safe replay_opts_release() repeatedly, but let's fix this properly instead, by having the owner of the data free() it. See [2] for the initial implementation of "sequencer_remove_state()", which assumed that it should be removing the full (including on-disk) rebase state as a one-off. 1. 73fdc535d26 (rebase -i: use struct rebase_options to parse args, 2019-04-17) 2. 26ae337be11 (revert: Introduce --reset to remove sequencer state, 2011-08-04) Signed-off-by: Ævar Arnfjörð Bjarmason --- builtin/rebase.c | 4 ++++ builtin/revert.c | 2 ++ sequencer.c | 4 +--- sequencer.h | 1 + t/t3405-rebase-malformed.sh | 1 + t/t3412-rebase-root.sh | 1 + t/t3419-rebase-patch-id.sh | 1 + t/t3423-rebase-reword.sh | 1 + t/t3425-rebase-topology-merges.sh | 2 ++ t/t3437-rebase-fixup-options.sh | 1 + t/t3438-rebase-broken-files.sh | 2 ++ t/t3501-revert-cherry-pick.sh | 1 + t/t3502-cherry-pick-merge.sh | 1 + t/t3503-cherry-pick-root.sh | 1 + t/t3506-cherry-pick-ff.sh | 1 + t/t3511-cherry-pick-x.sh | 1 + t/t7402-submodule-rebase.sh | 1 + t/t9106-git-svn-commit-diff-clobber.sh | 1 - t/t9164-git-svn-dcommit-concurrent.sh | 1 - 19 files changed, 23 insertions(+), 5 deletions(-) diff --git a/builtin/rebase.c b/builtin/rebase.c index 7141fd5e0c1..5859a5387d8 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -301,6 +301,7 @@ static int do_interactive_rebase(struct rebase_options *opts, unsigned flags) } cleanup: + replay_opts_release(&replay); string_list_clear(&commands, 0); free(revisions); free(shortrevisions); @@ -343,6 +344,7 @@ static int run_sequencer_rebase(struct rebase_options *opts) struct replay_opts replay_opts = get_replay_opts(opts); ret = sequencer_continue(the_repository, &replay_opts); + replay_opts_release(&replay_opts); break; } case ACTION_EDIT_TODO: @@ -558,6 +560,7 @@ static int finish_rebase(struct rebase_options *opts) replay.action = REPLAY_INTERACTIVE_REBASE; ret = sequencer_remove_state(&replay); + replay_opts_release(&replay); } else { strbuf_addstr(&dir, opts->state_dir); if (remove_dir_recursively(&dir, 0)) @@ -1331,6 +1334,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) replay.action = REPLAY_INTERACTIVE_REBASE; ret = sequencer_remove_state(&replay); + replay_opts_release(&replay); } else { strbuf_reset(&buf); strbuf_addstr(&buf, options.state_dir); diff --git a/builtin/revert.c b/builtin/revert.c index f2d86d2a8f9..1cab16bf3ed 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -251,6 +251,7 @@ int cmd_revert(int argc, const char **argv, const char *prefix) if (opts.revs) release_revisions(opts.revs); free(opts.revs); + replay_opts_release(&opts); return res; } @@ -267,5 +268,6 @@ int cmd_cherry_pick(int argc, const char **argv, const char *prefix) free(opts.revs); if (res < 0) die(_("cherry-pick failed")); + replay_opts_release(&opts); return res; } diff --git a/sequencer.c b/sequencer.c index d385bea2bed..8ff29262c1e 100644 --- a/sequencer.c +++ b/sequencer.c @@ -351,7 +351,7 @@ static const char *gpg_sign_opt_quoted(struct replay_opts *opts) return buf.buf; } -static void replay_opts_release(struct replay_opts *opts) +void replay_opts_release(struct replay_opts *opts) { free(opts->gpg_sign); free(opts->reflog_action); @@ -385,8 +385,6 @@ int sequencer_remove_state(struct replay_opts *opts) } } - replay_opts_release(opts); - strbuf_reset(&buf); strbuf_addstr(&buf, get_dir(opts)); if (remove_dir_recursively(&buf, 0)) diff --git a/sequencer.h b/sequencer.h index 888c18aad71..3bcdfa1b586 100644 --- a/sequencer.h +++ b/sequencer.h @@ -158,6 +158,7 @@ int sequencer_pick_revisions(struct repository *repo, int sequencer_continue(struct repository *repo, struct replay_opts *opts); int sequencer_rollback(struct repository *repo, struct replay_opts *opts); int sequencer_skip(struct repository *repo, struct replay_opts *opts); +void replay_opts_release(struct replay_opts *opts); int sequencer_remove_state(struct replay_opts *opts); #define TODO_LIST_KEEP_EMPTY (1U << 0) diff --git a/t/t3405-rebase-malformed.sh b/t/t3405-rebase-malformed.sh index 25243318618..8979bc34073 100755 --- a/t/t3405-rebase-malformed.sh +++ b/t/t3405-rebase-malformed.sh @@ -5,6 +5,7 @@ test_description='rebase should handle arbitrary git message' GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh . "$TEST_DIRECTORY"/lib-rebase.sh diff --git a/t/t3412-rebase-root.sh b/t/t3412-rebase-root.sh index 58371d8a547..e75b3d0e07c 100755 --- a/t/t3412-rebase-root.sh +++ b/t/t3412-rebase-root.sh @@ -7,6 +7,7 @@ Tests if git rebase --root --onto can rebase the root commit. GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh log_with_names () { diff --git a/t/t3419-rebase-patch-id.sh b/t/t3419-rebase-patch-id.sh index 7181f176b81..6c61f240cf9 100755 --- a/t/t3419-rebase-patch-id.sh +++ b/t/t3419-rebase-patch-id.sh @@ -5,6 +5,7 @@ test_description='git rebase - test patch id computation' GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh scramble () { diff --git a/t/t3423-rebase-reword.sh b/t/t3423-rebase-reword.sh index 4859bb8f722..2fab703d615 100755 --- a/t/t3423-rebase-reword.sh +++ b/t/t3423-rebase-reword.sh @@ -2,6 +2,7 @@ test_description='git rebase interactive with rewording' +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh . "$TEST_DIRECTORY"/lib-rebase.sh diff --git a/t/t3425-rebase-topology-merges.sh b/t/t3425-rebase-topology-merges.sh index 63acc1ea4da..a16428bdf54 100755 --- a/t/t3425-rebase-topology-merges.sh +++ b/t/t3425-rebase-topology-merges.sh @@ -1,6 +1,8 @@ #!/bin/sh test_description='rebase topology tests with merges' + +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh . "$TEST_DIRECTORY"/lib-rebase.sh diff --git a/t/t3437-rebase-fixup-options.sh b/t/t3437-rebase-fixup-options.sh index c023fefd681..274699dadb8 100755 --- a/t/t3437-rebase-fixup-options.sh +++ b/t/t3437-rebase-fixup-options.sh @@ -14,6 +14,7 @@ to the "fixup" command that works with "fixup!", "fixup -C" works with "amend!" upon --autosquash. ' +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh . "$TEST_DIRECTORY"/lib-rebase.sh diff --git a/t/t3438-rebase-broken-files.sh b/t/t3438-rebase-broken-files.sh index b92a3ce46b8..c614c4f2e4b 100755 --- a/t/t3438-rebase-broken-files.sh +++ b/t/t3438-rebase-broken-files.sh @@ -1,6 +1,8 @@ #!/bin/sh test_description='rebase behavior when on-disk files are broken' + +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh test_expect_success 'set up conflicting branches' ' diff --git a/t/t3501-revert-cherry-pick.sh b/t/t3501-revert-cherry-pick.sh index 1f4cfc37449..2f3e3e24169 100755 --- a/t/t3501-revert-cherry-pick.sh +++ b/t/t3501-revert-cherry-pick.sh @@ -13,6 +13,7 @@ test_description='test cherry-pick and revert with renames GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh test_expect_success setup ' diff --git a/t/t3502-cherry-pick-merge.sh b/t/t3502-cherry-pick-merge.sh index 5495eacfec1..1b2c0d6aca6 100755 --- a/t/t3502-cherry-pick-merge.sh +++ b/t/t3502-cherry-pick-merge.sh @@ -11,6 +11,7 @@ test_description='cherry picking and reverting a merge GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh test_expect_success setup ' diff --git a/t/t3503-cherry-pick-root.sh b/t/t3503-cherry-pick-root.sh index 95fe4feaeee..76d393dc8a3 100755 --- a/t/t3503-cherry-pick-root.sh +++ b/t/t3503-cherry-pick-root.sh @@ -5,6 +5,7 @@ test_description='test cherry-picking (and reverting) a root commit' GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh test_expect_success setup ' diff --git a/t/t3506-cherry-pick-ff.sh b/t/t3506-cherry-pick-ff.sh index 7e11bd4a4c5..b71bad17b85 100755 --- a/t/t3506-cherry-pick-ff.sh +++ b/t/t3506-cherry-pick-ff.sh @@ -5,6 +5,7 @@ test_description='test cherry-picking with --ff option' GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh test_expect_success setup ' diff --git a/t/t3511-cherry-pick-x.sh b/t/t3511-cherry-pick-x.sh index 84a587daf3a..dd5d92ef302 100755 --- a/t/t3511-cherry-pick-x.sh +++ b/t/t3511-cherry-pick-x.sh @@ -2,6 +2,7 @@ test_description='Test cherry-pick -x and -s' +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh pristine_detach () { diff --git a/t/t7402-submodule-rebase.sh b/t/t7402-submodule-rebase.sh index ebeca12a711..b19792b3269 100755 --- a/t/t7402-submodule-rebase.sh +++ b/t/t7402-submodule-rebase.sh @@ -5,6 +5,7 @@ test_description='Test rebasing, stashing, etc. with submodules' +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh test_expect_success setup ' diff --git a/t/t9106-git-svn-commit-diff-clobber.sh b/t/t9106-git-svn-commit-diff-clobber.sh index 3cab0b9720a..bca496c40e0 100755 --- a/t/t9106-git-svn-commit-diff-clobber.sh +++ b/t/t9106-git-svn-commit-diff-clobber.sh @@ -3,7 +3,6 @@ # Copyright (c) 2006 Eric Wong test_description='git svn commit-diff clobber' -TEST_FAILS_SANITIZE_LEAK=true . ./lib-git-svn.sh test_expect_success 'initialize repo' ' diff --git a/t/t9164-git-svn-dcommit-concurrent.sh b/t/t9164-git-svn-dcommit-concurrent.sh index 1465156072e..c8e6c0733f4 100755 --- a/t/t9164-git-svn-dcommit-concurrent.sh +++ b/t/t9164-git-svn-dcommit-concurrent.sh @@ -5,7 +5,6 @@ test_description='concurrent git svn dcommit' -TEST_FAILS_SANITIZE_LEAK=true . ./lib-git-svn.sh From patchwork Wed Jan 18 16:09:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 13106644 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 CA54FC38147 for ; Wed, 18 Jan 2023 16:14:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230380AbjARQOS (ORCPT ); Wed, 18 Jan 2023 11:14:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229881AbjARQNg (ORCPT ); Wed, 18 Jan 2023 11:13:36 -0500 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEE57303E3 for ; Wed, 18 Jan 2023 08:09:30 -0800 (PST) Received: by mail-ej1-x62e.google.com with SMTP id vw16so21276642ejc.12 for ; Wed, 18 Jan 2023 08:09:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oqE5wxpe0Zeqdrb9j7YRheUEknF+3PccLdohqn+TZAo=; b=DHs+Hd1vARWTtARESmgtyWinMqYNhAtN/oVJ8KirenWpByvpxtNX+/XtGfn0R2udoh TVrzHY7JQpYM81g3hpesNGj8AQc0j4SEH1CGJ9lPQV6w1Pl0EsE9IzLwwhiyefvdXUcu aWLQ/4rQD5iuxKMsUeAYhH9R1uBCWRTt77JmlY3otVIlXb1Hpc+9zkjcZP/NIIGxHqkX oHsyvmC6kmwnxPlaAUuELA1YhjmeM76xv0ocs/g5HVYOkyd1di9AklKOs1rWrbuiNiDH HS2cdjWmVVy/lXO4p/Qhbe0no8eH84poYrEy1h1Nm3jVXZnrr0jHWxU8fdmBMmaxT2qB M32A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oqE5wxpe0Zeqdrb9j7YRheUEknF+3PccLdohqn+TZAo=; b=AErJ3jo7nYwoGN7tje5vJnzxmLRp4F46W9V49UoO/+yToaSRmvRIObBlddJYx6cae6 2gktJaQE/F+y4watrAvbOLrOrVyAfLuIi/alywovxTX7DWaCKXiVZ1jxdNrNM5dbl31r 9JOQ2Bq4Q4UXmG66KIGA5KC4RkCfjy0EL5ylTnT7mXFgyL+DgcZZY4CKdpjLhsDpTKtW 7xJOt/bvgNGiQnb0vHxvL6AHJ9KGVjzdq4CpE+r4McXDfX24ifBQt3racXOMGnjOKADl Uh/XuujwF3joUujKTehNHzOAPCDZhVYRMif7GLAVyAHc4TFBn4ZaD6bIIsTOIJECw32F xaZw== X-Gm-Message-State: AFqh2kqunbUsB4l1iiFq1eYn4Oerq6L/RAv6jq2aXwwQO59X+oioq4mB cPgsAq7TpFMl82K1+rT2QU8ZXhP+/I+TvA== X-Google-Smtp-Source: AMrXdXv0CGaKgOxUxzg4qCtJouv7I1gAioNakDwaoeMri6pi80GMWYlq3S1hsUvTpF6wHhKPBis6MQ== X-Received: by 2002:a17:907:3e18:b0:84d:3403:f4f2 with SMTP id hp24-20020a1709073e1800b0084d3403f4f2mr10292368ejc.62.1674058169071; Wed, 18 Jan 2023 08:09:29 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id du1-20020a17090772c100b0084bfd56fb3bsm14778202ejc.162.2023.01.18.08.09.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 08:09:28 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Phillip Wood , Johannes Schindelin , Junio C Hamano , Taylor Blau , =?utf-8?q?Ren=C3=A9_Scharfe?= , =?utf-8?b?w4Z2YXIgQXJuZmo=?= =?utf-8?b?w7Zyw7AgQmphcm1hc29u?= Subject: [PATCH v3 4/8] builtin/revert.c: move free-ing of "revs" to replay_opts_release() Date: Wed, 18 Jan 2023 17:09:12 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.1225.g30a3d88132d In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In [1] and [2] I added the code being moved here to cmd_revert() and cmd_cherry_pick(), now that we've got a "replay_opts_release()" for the "struct replay_opts" it should know how to free these "revs", rather than having these users reach into the struct to free its individual members. 1. d1ec656d68f (cherry-pick: free "struct replay_opts" members, 2022-11-08) 2. fd74ac95ac3 (revert: free "struct replay_opts" members, 2022-07-01) Signed-off-by: Ævar Arnfjörð Bjarmason --- builtin/revert.c | 6 ------ sequencer.c | 3 +++ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/builtin/revert.c b/builtin/revert.c index 1cab16bf3ed..77d2035616e 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -248,9 +248,6 @@ int cmd_revert(int argc, const char **argv, const char *prefix) res = run_sequencer(argc, argv, &opts); if (res < 0) die(_("revert failed")); - if (opts.revs) - release_revisions(opts.revs); - free(opts.revs); replay_opts_release(&opts); return res; } @@ -263,9 +260,6 @@ int cmd_cherry_pick(int argc, const char **argv, const char *prefix) opts.action = REPLAY_PICK; sequencer_init_config(&opts); res = run_sequencer(argc, argv, &opts); - if (opts.revs) - release_revisions(opts.revs); - free(opts.revs); if (res < 0) die(_("cherry-pick failed")); replay_opts_release(&opts); diff --git a/sequencer.c b/sequencer.c index 8ff29262c1e..ea568d99498 100644 --- a/sequencer.c +++ b/sequencer.c @@ -361,6 +361,9 @@ void replay_opts_release(struct replay_opts *opts) free(opts->xopts[i]); free(opts->xopts); strbuf_release(&opts->current_fixups); + if (opts->revs) + release_revisions(opts->revs); + free(opts->revs); } int sequencer_remove_state(struct replay_opts *opts) From patchwork Wed Jan 18 16:09:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 13106648 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 AB09BC32793 for ; Wed, 18 Jan 2023 16:14:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230423AbjARQOc (ORCPT ); Wed, 18 Jan 2023 11:14:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230281AbjARQNl (ORCPT ); Wed, 18 Jan 2023 11:13:41 -0500 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E3713B0FE for ; Wed, 18 Jan 2023 08:09:42 -0800 (PST) Received: by mail-ej1-x629.google.com with SMTP id v6so41421169ejg.6 for ; Wed, 18 Jan 2023 08:09:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Z+IjleXLUY2FD//iM8u3pY5k/TMt0rdAo/whUNXopwM=; b=aKeuDl2/a3LpOKCy3iCNt4+Vs3b3XPMMeKvN0QewzIaPJRjSok8XvCOw5svreT8BcY ZTsR4AmtYopVsUorT1vx8cQZbdq7xUCxjpyG7LeWH6BGRgKEDosbvQNXEjlMluY4jisI rTf9wuzLm1Cgioz3XF2rKxMqdkbpcYHPPj172yUCSfnvdqOLaLKRds9u0CBAq53GPEr6 mp7qZxdOZvQTuFqiKqi+wr2Sjm8NBIc185x89cwg6ERiaYRMzZKxmcH5j1SPJ/9zf4Zz iLo+hllkSh16PKXO7zV7CHycmDPQMI87qepLo4gn+JZYX7BvCD1w4F+iZRrRWys2lFlb P2hA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z+IjleXLUY2FD//iM8u3pY5k/TMt0rdAo/whUNXopwM=; b=pASJ19hrVSMl8fdC8zzgy6mxaxzYeIQFUeGhicFbfBmzZhG4AKW73W7vmawihXAhW1 paEQ8acLYIwp8JqUdKyGpU+iocm1FC3+4s1tXFz4K/yHWScW/LN9Xx3SvZtBTPpKRix+ AZvb0sctwBDTfWL+2kRxP79AGRGDNuCsmly4q/OmymsJ0FXLHNuibjmnD9UyE85T5ru9 O8sGXi0GXe1rLXsi6sRpKCE3Gyry5eXAP38yrQ0WbTxZHUFfkPKDSFE721eEJhikBiJd YATjP0i5whco2eaA2lalrFsNgkDtS14Mii16ZkGGtVnjcAoP+mu4ej9Jy5nDUhwr1QPv fRSQ== X-Gm-Message-State: AFqh2kpAMVryT2rBdVaNGXEImBRB/XOoHqWs/TdATW0vfUmGM0KxRxmD 4NGwJ8Qw6EPKIWSR8ZLs2Rqo1z+QHm2IJA== X-Google-Smtp-Source: AMrXdXuAb8zwvNb8/MiiQhRCF7nF+rF2HI/HYqdvRyoaAwc3QQlPZzgGXgldZloE4H2kLzhbOO7hZg== X-Received: by 2002:a17:906:60d0:b0:877:612e:516e with SMTP id f16-20020a17090660d000b00877612e516emr4128422ejk.61.1674058169842; Wed, 18 Jan 2023 08:09:29 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id du1-20020a17090772c100b0084bfd56fb3bsm14778202ejc.162.2023.01.18.08.09.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 08:09:29 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Phillip Wood , Johannes Schindelin , Junio C Hamano , Taylor Blau , =?utf-8?q?Ren=C3=A9_Scharfe?= , =?utf-8?b?w4Z2YXIgQXJuZmo=?= =?utf-8?b?w7Zyw7AgQmphcm1hc29u?= Subject: [PATCH v3 5/8] builtin/rebase.c: fix "options.onto_name" leak Date: Wed, 18 Jan 2023 17:09:13 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.1225.g30a3d88132d In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Similar to the existing "squash_onto_name" added in [1] we need to free() the xstrdup()'d "options.onto.name" added for "--keep-base" in [2].. 1. 9dba809a69a (builtin rebase: support --root, 2018-09-04) 2. 414d924beb4 (rebase: teach rebase --keep-base, 2019-08-27) Signed-off-by: Ævar Arnfjörð Bjarmason --- builtin/rebase.c | 4 +++- t/t3416-rebase-onto-threedots.sh | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/builtin/rebase.c b/builtin/rebase.c index 5859a5387d8..5c474fb6edd 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -1037,6 +1037,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) struct string_list strategy_options = STRING_LIST_INIT_NODUP; struct object_id squash_onto; char *squash_onto_name = NULL; + char *keep_base_onto_name = NULL; int reschedule_failed_exec = -1; int allow_preemptive_ff = 1; int preserve_merges_selected = 0; @@ -1660,7 +1661,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) strbuf_addstr(&buf, options.upstream_name); strbuf_addstr(&buf, "..."); strbuf_addstr(&buf, branch_name); - options.onto_name = xstrdup(buf.buf); + options.onto_name = keep_base_onto_name = xstrdup(buf.buf); } else if (!options.onto_name) options.onto_name = options.upstream_name; if (strstr(options.onto_name, "...")) { @@ -1836,6 +1837,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) free(options.strategy); strbuf_release(&options.git_format_patch_opt); free(squash_onto_name); + free(keep_base_onto_name); string_list_clear(&exec, 0); string_list_clear(&strategy_options, 0); return !!ret; diff --git a/t/t3416-rebase-onto-threedots.sh b/t/t3416-rebase-onto-threedots.sh index ea501f2b42b..f8c4ed78c9e 100755 --- a/t/t3416-rebase-onto-threedots.sh +++ b/t/t3416-rebase-onto-threedots.sh @@ -5,6 +5,7 @@ test_description='git rebase --onto A...B' GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh . "$TEST_DIRECTORY/lib-rebase.sh" From patchwork Wed Jan 18 16:09:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 13106645 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 CB14AC38159 for ; Wed, 18 Jan 2023 16:14:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229972AbjARQOT (ORCPT ); Wed, 18 Jan 2023 11:14:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230239AbjARQNh (ORCPT ); Wed, 18 Jan 2023 11:13:37 -0500 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 602403250E for ; Wed, 18 Jan 2023 08:09:32 -0800 (PST) Received: by mail-ej1-x632.google.com with SMTP id kt14so25531742ejc.3 for ; Wed, 18 Jan 2023 08:09:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=V5LVRAk+TBXjsdmx9T0iYBzU2Pp235dr80UzXOD8kjo=; b=aL77JgG/eiq1TCoaWl+1TD+Xd8YGjRwpjg8eDMrfMazI8NndMZFkup2apsrGrs3LfY U3Vcx8It4TeGkivzlsc2BiBQYSqa8kJ9E/r70AkiIyJwesd/9jjgu5b6fJJBRnyypBkm A1qSeTQWKmnVqe1cyFvnpOumFqNTDQc7tep5unn+ueM0uoM0GBivekT4srvZyUuWkKqi aoc2kOTyYbfWRJy9kwspbMZggOXTdRRHHFwfOju4RnDsygozgHT8QV7LeY66rVerRDtR MB+gqDlKXlDG9lDNrs8RSk+dys+NaNnDxqCmQBeW94Izo9B++MZdHHPVZgeESuUzHHME uKjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=V5LVRAk+TBXjsdmx9T0iYBzU2Pp235dr80UzXOD8kjo=; b=3Oak4pcv/V0dUlRXz46qSCk/e/YXk39O9u1FMb2HjPgdf2KotdBkvTAU72/YrErs4H uAM6OeME6oPCMfxkejzgaz7KRAPdu3tlmm4XafTgcVj3nAS5usWF4eGyv9U/88goPQ/0 Rp5vrn3289qafw5N8jVzT1GIvFO3uXrMRzVctEKe4WJ/g6urzEFt4oYiW0Sb28tH5J8i o1k7bg27AmdtdaSaStyoPcdRAJPYKpMr8i7vQyQhZHdw4NMB791jVCdRfmBgIJ7satrn GDpIVJp0D4IwFf4+dEi7pO6B0qDHh+Izd2pGSltbmYgstXUld+nzCuBuY+JuQfreyo9A 8n3w== X-Gm-Message-State: AFqh2kqZdgdvn0vVAR5pMX7eDJrmUpyrlWwBZ6VtkmTlHYeKlKi/9kAS Hu3Vt3gdhlr1i2oTCEIDHQQOnPI+4sPeDA== X-Google-Smtp-Source: AMrXdXtDcOUGIzfvQQgQiIazpJ++9EdQhNWTH7rWKBglDIlHqQ01b5er/0e7f5Vw5AknsJHOVT/RLA== X-Received: by 2002:a17:906:af94:b0:86d:bbf9:302 with SMTP id mj20-20020a170906af9400b0086dbbf90302mr7293680ejb.20.1674058170486; Wed, 18 Jan 2023 08:09:30 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id du1-20020a17090772c100b0084bfd56fb3bsm14778202ejc.162.2023.01.18.08.09.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 08:09:30 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Phillip Wood , Johannes Schindelin , Junio C Hamano , Taylor Blau , =?utf-8?q?Ren=C3=A9_Scharfe?= , =?utf-8?b?w4Z2YXIgQXJuZmo=?= =?utf-8?b?w7Zyw7AgQmphcm1hc29u?= Subject: [PATCH v3 6/8] sequencer.c: always free() the "msgbuf" in do_pick_commit() Date: Wed, 18 Jan 2023 17:09:14 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.1225.g30a3d88132d In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In [1] the strbuf_release(&msgbuf) was moved into this do_pick_commit(), but didn't take into account the case of [2], where we'd return before the strbuf_release(&msgbuf). Then when the "fixup" support was added in [3] this leak got worse, as in this error case we added another place where we'd "return" before reaching the strbuf_release(). This changes the behavior so that we'll call update_abort_safety_file() in these cases where we'd previously "return", but as noted in [4] "update_abort_safety_file() is a no-op when rebasing and you're changing code that is only run when rebasing.". Here "no-op" refers to the early return in update_abort_safety_file() if git_path_seq_dir() doesn't exist. 1. 452202c74b8 (sequencer: stop releasing the strbuf in write_message(), 2016-10-21) 2. f241ff0d0a9 (prepare the builtins for a libified merge_recursive(), 2016-07-26) 3. 6e98de72c03 (sequencer (rebase -i): add support for the 'fixup' and 'squash' commands, 2017-01-02) 4. https://lore.kernel.org/git/bcace50b-a4c3-c468-94a3-4fe0c62b3671@dunelm.org.uk/ Signed-off-by: Ævar Arnfjörð Bjarmason --- sequencer.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/sequencer.c b/sequencer.c index ea568d99498..2c5ed5bc5ea 100644 --- a/sequencer.c +++ b/sequencer.c @@ -2277,8 +2277,10 @@ static int do_pick_commit(struct repository *r, reword = 1; else if (is_fixup(command)) { if (update_squash_messages(r, command, commit, - opts, item->flags)) - return -1; + opts, item->flags)) { + res = -1; + goto leave; + } flags |= AMEND_MSG; if (!final_fixup) msg_file = rebase_path_squash_msg(); @@ -2288,9 +2290,11 @@ static int do_pick_commit(struct repository *r, } else { const char *dest = git_path_squash_msg(r); unlink(dest); - if (copy_file(dest, rebase_path_squash_msg(), 0666)) - return error(_("could not rename '%s' to '%s'"), - rebase_path_squash_msg(), dest); + if (copy_file(dest, rebase_path_squash_msg(), 0666)) { + res = error(_("could not rename '%s' to '%s'"), + rebase_path_squash_msg(), dest); + goto leave; + } unlink(git_path_merge_msg(r)); msg_file = dest; flags |= EDIT_MSG; @@ -2328,7 +2332,6 @@ static int do_pick_commit(struct repository *r, free_commit_list(common); free_commit_list(remotes); } - strbuf_release(&msgbuf); /* * If the merge was clean or if it failed due to conflict, we write @@ -2402,6 +2405,7 @@ static int do_pick_commit(struct repository *r, leave: free_message(commit, &msg); free(author); + strbuf_release(&msgbuf); update_abort_safety_file(); return res; From patchwork Wed Jan 18 16:09:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 13106647 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 68D17C32793 for ; Wed, 18 Jan 2023 16:14:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230403AbjARQO1 (ORCPT ); Wed, 18 Jan 2023 11:14:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230247AbjARQNh (ORCPT ); Wed, 18 Jan 2023 11:13:37 -0500 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10ADB34563 for ; Wed, 18 Jan 2023 08:09:33 -0800 (PST) Received: by mail-ej1-x62b.google.com with SMTP id kt14so25531860ejc.3 for ; Wed, 18 Jan 2023 08:09:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AIouauJ2l3wS+CHYUGO5vLZVZ8kJhEC0ypzbVS08p1g=; b=bGhrNZ3MGZ+SR4jp6FWtwBD/X3G81xQXX71WbmTPjiOqKG0T4QFKyiHG7eLHHQLTmq vZbVrHTHi81x4tTZiWBKnTo4YUgPBaU3nWZsBuVLpx6YJUTxB/r6lbfvWDeaPg/hGMaO RgTcCwuGLYg8WfErobNqUFSUMwYWwAMa9KIhPfkee/u+PTQ/KOYyCrIOujFLU/n5GDNn 6G7Z/q22TbVgWcIlKkDe3Pfm7swI1bhD5nU1IXgmNTlsPQOCEExY1t9oJBQujgSYe/Qh NaFdjkjOqYJRCqNWuw0qBQxrMMYO6gmLlLiwXSWbuSFnqANvhDL4+0i/im6t+BDAG2cE D+ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AIouauJ2l3wS+CHYUGO5vLZVZ8kJhEC0ypzbVS08p1g=; b=gXFCrpVLwdmXRLV5omcThAS11s7mmB6BeI1FGqMVcy/UH47+SgYAYkL2Z/D6Ho/UKE 6VaX2/5bo0fquhg+Lvvr7wNtnHo3lQAXtu2I7eug5rY3r7N9NZhDo1RW52AVq3l1MYrg m1BcVb6OWCPf+WLm9VLTj3gnsKnOJPpLLLYjhc9JmBVdpRiXjglKIiD2iNx1HbVpZaWZ Cs2e68Fl/gCiVfQbAVZau7zUvqFPl1zy3U4Yu6qfWqywsUQkmXulikGi2l0mD4IyVwGm RdRLRe/GdhIJoN4BRPcnHrmHitVpKy74d6RhrJCBEJj8lrTTD899nJx6vdI2GOCySfr2 n9pQ== X-Gm-Message-State: AFqh2kpM5fhsEEoEGKd8+uJ9Z5RXbCs0hN6WQ1faOGPdPY/yv/4p+Dd3 3iiRSpGZ53rqZAek/jdDWrWPD4jCJfC32g== X-Google-Smtp-Source: AMrXdXuAgwRtlJVOeaT4Ln23s6yF0WUArYmRju9OnN8X7ocQsxcN6ia1KThUac6edoE4wTo3F54t7w== X-Received: by 2002:a17:907:1110:b0:872:bb39:a6e1 with SMTP id qu16-20020a170907111000b00872bb39a6e1mr6964715ejb.52.1674058171411; Wed, 18 Jan 2023 08:09:31 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id du1-20020a17090772c100b0084bfd56fb3bsm14778202ejc.162.2023.01.18.08.09.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 08:09:30 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Phillip Wood , Johannes Schindelin , Junio C Hamano , Taylor Blau , =?utf-8?q?Ren=C3=A9_Scharfe?= , =?utf-8?b?w4Z2YXIgQXJuZmo=?= =?utf-8?b?w7Zyw7AgQmphcm1hc29u?= Subject: [PATCH v3 7/8] builtin/rebase.c: free() "options.strategy_opts" Date: Wed, 18 Jan 2023 17:09:15 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.1225.g30a3d88132d In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When the "strategy_opts" member was added in ba1905a5fef (builtin rebase: add support for custom merge strategies, 2018-09-04) the corresponding free() for it at the end of cmd_rebase() wasn't added, let's do so. Signed-off-by: Ævar Arnfjörð Bjarmason --- builtin/rebase.c | 1 + 1 file changed, 1 insertion(+) diff --git a/builtin/rebase.c b/builtin/rebase.c index 5c474fb6edd..611c1d20ddf 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -1835,6 +1835,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) free(options.gpg_sign_opt); free(options.cmd); free(options.strategy); + free(options.strategy_opts); strbuf_release(&options.git_format_patch_opt); free(squash_onto_name); free(keep_base_onto_name); From patchwork Wed Jan 18 16:09:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 13106646 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 A83C5C32793 for ; Wed, 18 Jan 2023 16:14:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230239AbjARQOX (ORCPT ); Wed, 18 Jan 2023 11:14:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230262AbjARQNh (ORCPT ); Wed, 18 Jan 2023 11:13:37 -0500 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E688C32E5D for ; Wed, 18 Jan 2023 08:09:32 -0800 (PST) Received: by mail-ej1-x630.google.com with SMTP id az20so65334081ejc.1 for ; Wed, 18 Jan 2023 08:09:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=E0IwC/QvznkVbsg+2+t8x4z6DeiWD7kSq78LzrmvRuo=; b=J2WXE7gbsT3M3C455SNC9XZrZYyWNysEu36PJPu3BsQjylMRX2R3NIWZdJcsocxmFi Z04C4hgRFYVVFhl/1LUP9wOlNxtNmt89CuawTW9Lex9UEaTU28FTIj02hMj5CdVzRbRg 9Lj1uZhBqkUFS7scXMSewVn4DwwNQ0R+LDtIvoST1dGmEr41ooAIdd1QCme/ZyQL5Mo4 FPcgdp4sFcUzWuBOwhAqb9Wvkl00+N6etdn6gwfRyczvWR8eQH0RGGQduaM8vephIq46 7Imh5UC9SvAVhSpKxeevagFHc4Gp+d6y+jQQQc43KDs01uov9O9w1j5BByCVZzmSpuQ+ Mddw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=E0IwC/QvznkVbsg+2+t8x4z6DeiWD7kSq78LzrmvRuo=; b=faq0GDg+wCedhJCq1Tzyfwy6QXsdneEnqioFZ/zy/KQaBenzh5Sy1y/DdfCYMT0m0N HO2qhbZuQLf0Pbr5z4DuGtVMSVkhGAS1l0rrVAlUPfvqmwqcgU1W5COhBstalQN7vYn+ Em85RZZaXoWBWp+sBVcURzfb6BIKBkR13FWlgsU7AUHH6AwLde3wXwO8IR7DPU+vQ8Ql DDXjNEvFVu8h5coAJj4FMx56HzV4+kiJgcRadsOhtP83yhu4aPLtPo38Rs8iSbNQ94nG jOoWdz7QHTyeGKop4HF4BUwCWQwn4kFg/knzLkAn9VcqRsCwTQRkX+b2xr9/ILwI+RUM b7qA== X-Gm-Message-State: AFqh2kpzKq4/N7frrHA5c7j0yDKGL7RTypiJKQuRs2plqap5aYmxEuHl Zb/0PHgMVGqxM4rrTxY+VplNEFUgwvPicw== X-Google-Smtp-Source: AMrXdXtHUKZm1PRjPCZR6RRgK0LOujOwlAHaOHx8jgO4WqRBSYSfE7wQD03RCTBxLJYnBzr7W4P2sQ== X-Received: by 2002:a17:906:d937:b0:7fc:4242:fa1d with SMTP id rn23-20020a170906d93700b007fc4242fa1dmr8059306ejb.54.1674058172283; Wed, 18 Jan 2023 08:09:32 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id du1-20020a17090772c100b0084bfd56fb3bsm14778202ejc.162.2023.01.18.08.09.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 08:09:31 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Phillip Wood , Johannes Schindelin , Junio C Hamano , Taylor Blau , =?utf-8?q?Ren=C3=A9_Scharfe?= , =?utf-8?b?w4Z2YXIgQXJuZmo=?= =?utf-8?b?w7Zyw7AgQmphcm1hc29u?= Subject: [PATCH v3 8/8] commit.c: free() revs.commit in get_fork_point() Date: Wed, 18 Jan 2023 17:09:16 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.1225.g30a3d88132d In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Fix a memory leak that's been with us since d96855ff517 (merge-base: teach "--fork-point" mode, 2013-10-23). Signed-off-by: Ævar Arnfjörð Bjarmason --- commit.c | 1 + t/t3431-rebase-fork-point.sh | 1 + t/t3432-rebase-fast-forward.sh | 1 + 3 files changed, 3 insertions(+) diff --git a/commit.c b/commit.c index 14538a811ae..e433c33bb01 100644 --- a/commit.c +++ b/commit.c @@ -1033,6 +1033,7 @@ struct commit *get_fork_point(const char *refname, struct commit *commit) ret = bases->item; cleanup_return: + free(revs.commit); free_commit_list(bases); free(full_refname); return ret; diff --git a/t/t3431-rebase-fork-point.sh b/t/t3431-rebase-fork-point.sh index 70e81363569..4bfc779bb87 100755 --- a/t/t3431-rebase-fork-point.sh +++ b/t/t3431-rebase-fork-point.sh @@ -8,6 +8,7 @@ test_description='git rebase --fork-point test' GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh # A---B---D---E (main) diff --git a/t/t3432-rebase-fast-forward.sh b/t/t3432-rebase-fast-forward.sh index 5086e14c022..7f1a5dd3deb 100755 --- a/t/t3432-rebase-fast-forward.sh +++ b/t/t3432-rebase-fast-forward.sh @@ -8,6 +8,7 @@ test_description='ensure rebase fast-forwards commits when possible' GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh test_expect_success setup '