From patchwork Mon Feb 6 19:08:06 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: 13130514 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 F2BDBC636D4 for ; Mon, 6 Feb 2023 19:08:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229892AbjBFTIt (ORCPT ); Mon, 6 Feb 2023 14:08:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229676AbjBFTIr (ORCPT ); Mon, 6 Feb 2023 14:08:47 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 462A82B094 for ; Mon, 6 Feb 2023 11:08:46 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id o36so9416297wms.1 for ; Mon, 06 Feb 2023 11:08:46 -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=L1Boab3tQ90QviUbBcNMfzxJFBdLe2EOs/pGboSeW5Y=; b=nzxreF+ukM56DDMQiCavgoQR4yq2ZGLxGNdzKJKdaigo9rKNZFnzlNW/lR4rvcVeWd Zn4C1ShGumQgrWQZGZfZDQWNFofagQh67jqYK4AeNpzkmK0PclCo9SPq9iqLBToc4mYT 9LoFezzJoVUMvbD+MTU3eUYwMfYb9K8fSo/K45MWiCNz+HI+pKRCYBUp3iLyPZHdtVoX t46aOfGlKCiAKttGZFliMvR1m8ahVdamSPKt6zWsz3dkyZ4kXHuIjfWDL0KhvwDXuLBx +N8qFEB2UE6G2542wnHxl2dhvF1cQ2MeTUU4Lsh+SfbazHwrlXUdiyPzGt/GmNR3Z+K3 cfcw== 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=L1Boab3tQ90QviUbBcNMfzxJFBdLe2EOs/pGboSeW5Y=; b=yH6V2RkanfZP4UyozTD+CKa2rn8YbCNH4LMABC7waENStoajKz0gHCimuw05VCim3/ VsNkRyb+wX/nIxxAib7Hz+cm38CER8MgSCHyskv4F3VOu4ycfTeugtgYSJmBvDk+vPx/ rcMmLRU6wveUdEH1f1RdC9VbeVh9986fChDPw6+zqc4od6m9nZK98jqnLYyMyj1H9ZG+ icHrH3PCoHyJZVgV2Nc/URr0ypuC5DRZmpV3DLw0QcqHUPn45wfGWrx6Nb30AvACqFI6 A511Wir6g4t3fw6m5OFnfOg1vDbPSCNRvzJwbG8uA4H/PfY2kCeGEWDiXXJQGM8oXBqi t3IA== X-Gm-Message-State: AO0yUKVYkpVVBpn6FFr4bqYuzMOYLm/V5E/YCpupTN37X9Ers4MLsTge E3jW8s2j4jSARpNZUaFsoU6SAcGsRWtMUrCq X-Google-Smtp-Source: AK7set9V4F7jGeF5aMY8sHQDIpV0GdI2Sy7gD9TfopTpeHG+0Hs28byA9sGnzNmhvf0b9mmROjokuQ== X-Received: by 2002:a05:600c:4910:b0:3e0:c97:f1d0 with SMTP id f16-20020a05600c491000b003e00c97f1d0mr738097wmp.20.1675710524577; Mon, 06 Feb 2023 11:08:44 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id p2-20020a05600c358200b003dc4ecfc4d7sm12538595wmq.29.2023.02.06.11.08.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Feb 2023 11:08:43 -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 v4 1/8] rebase: use "cleanup" pattern in do_interactive_rebase() Date: Mon, 6 Feb 2023 20:08:06 +0100 Message-Id: X-Mailer: git-send-email 2.39.1.1425.ge02fe682bd8 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 7171be40eeb..c97ce642cf3 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -254,7 +254,7 @@ static int init_basic_state(struct replay_opts *opts, const char *head_name, 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; @@ -262,16 +262,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", @@ -300,6 +296,7 @@ static int do_interactive_rebase(struct rebase_options *opts, unsigned flags) opts->autosquash, opts->update_refs, &todo_list); } +cleanup: free(revisions); free(shortrevisions); todo_list_release(&todo_list); From patchwork Mon Feb 6 19:08:07 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: 13130515 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 174BCC05027 for ; Mon, 6 Feb 2023 19:08:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229964AbjBFTIv (ORCPT ); Mon, 6 Feb 2023 14:08:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229873AbjBFTIs (ORCPT ); Mon, 6 Feb 2023 14:08:48 -0500 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97B002B091 for ; Mon, 6 Feb 2023 11:08:47 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id hn2-20020a05600ca38200b003dc5cb96d46so11498691wmb.4 for ; Mon, 06 Feb 2023 11:08:47 -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=f9ff3x2NgXbDUwLQwuAkvnY4NbIsuw7HvaFDlZV/vVs=; b=MhCNP2gZPIVC7nyMHjFABxtGpre3hk9EG+CBbna0MBmCHRDGCbZoIqodVgocG0OzoO Wj2WLMS7vb8UbLrVNykiUL7p5n0oRvIDA3ykcACIxow9TK6N2G5tEG1i3Cqr/Gwcol6H 2IVFaPVVF1wh6nrZ9VqDOW4x4bNlnr4Cijn+ZtbL2unzkIUyhGHwDQOuHWdnIm7NOsRZ 43hiJ9TS7pb3GyeZj+dzwwcG0Ce4x6s+NmsibNIekq7Hbmb2AwE8lLR4fofwlLUZTdri 1CLXw13w1YFu9yDnUlQ3asKWLeyu55ApNsCHTJrkvmYnxQXqPqr/OIQ3RWMXGriNlrN+ 8lYw== 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=f9ff3x2NgXbDUwLQwuAkvnY4NbIsuw7HvaFDlZV/vVs=; b=xQpFtfnAaiTYjDgou6HiP8E8IPgHnjpwjx9fpM5tgKQQtaodp+jNovIm4351mkN3ms P7ikuyzVfsJuESi9mI/NgYmSVPO3JbKtW3jkzz/R5pQhbvCPC1eW1+3b/zwAcWvSeqZ8 xFNgl7QSOqs31tGheFmSlL8DPEN9aA5Dg2eaqTZBX9qzgQreYSTsAJSD0+BfhSCmyHqj 08fAMbmYM0gpnxNYcXgMfqUprxoGs5cnLZmtdRvrWTpSOc7GdfAlokz1BXCuI4z3RK2o Ayas0jLJi7v9ltolzDZL8K8iN1sA+rXytd0b3wlS2IvaZXdZTBWVULedx0Q0cCLZ/t4R Oq8g== X-Gm-Message-State: AO0yUKU6J10YoKpKEK9K8aCt3pOisEEmWEkVa9lG/U8QSeskazIl96Vh tGI8Snzn/6ItXwnzz729ncAcAaVSa+jgzyEk X-Google-Smtp-Source: AK7set8JAOmwE1dwtq8uqWnumpz7ty2GufI30v3cuRRQfAK6tM/5Q+9gmB6B2B2I1NyBWNo4qD7gmA== X-Received: by 2002:a05:600c:4918:b0:3dc:d5c:76d9 with SMTP id f24-20020a05600c491800b003dc0d5c76d9mr820292wmp.0.1675710525795; Mon, 06 Feb 2023 11:08:45 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id p2-20020a05600c358200b003dc4ecfc4d7sm12538595wmq.29.2023.02.06.11.08.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Feb 2023 11:08:45 -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 v4 2/8] sequencer.c: split up sequencer_remove_state() Date: Mon, 6 Feb 2023 20:08:07 +0100 Message-Id: X-Mailer: git-send-email 2.39.1.1425.ge02fe682bd8 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 3e4a1972897..b6392b43204 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 Mon Feb 6 19:08:08 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: 13130516 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 F2D6BC6379F for ; Mon, 6 Feb 2023 19:08:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230035AbjBFTIw (ORCPT ); Mon, 6 Feb 2023 14:08:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229923AbjBFTIv (ORCPT ); Mon, 6 Feb 2023 14:08:51 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2BBA2B094 for ; Mon, 6 Feb 2023 11:08:48 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id j29-20020a05600c1c1d00b003dc52fed235so9665107wms.1 for ; Mon, 06 Feb 2023 11:08:48 -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=S6vR8GQ5rIUq8qqaqjfGnPRemR6Wta1o/HTk6vZIu1w=; b=J+hgsNXiRw0kUKuRL8Rwb0QClAvSS0cZiO2wCmbGYMlOwBgtpSNyz5PnehgDeRNuST T3okxcKY7IkEfloI1frzzzuxT6Y6ugi2M5rLAh4R4LHPmwkL5LEuASJArlo5qKQSJ6vX 1mHhov+wLC3rQQRdmi1vnvmQMI1hK6gW5n7W/ivXiWwR1L0zca8Ef57UjKVFJ5W+mPre fGBsKPwxufJgvH/LawHaGhSwHIbVlMFGTeAriIpxrP+J279klOe8HM6hg1vvAJr/4H75 Gip2uTTiXHxpxdl/xYy3VZ3I9AsVYU8oND2nsx3ewR8tKrPGjEMkfc3MZIoNdVjc5Jzr NXvg== 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=S6vR8GQ5rIUq8qqaqjfGnPRemR6Wta1o/HTk6vZIu1w=; b=HZqP/YjD8mS1Wisz5RycXDadguzNGzb5QD4h3GOU05wF4pkp433LmpJ7npNDotuhZU ji2wW4RhMoav10+WIkkDjdPzaVV5S4ZFBQkEtB1B+p/UhVRWwGkWw4zK/1e5pX7NEC26 ZjhviyTlpghcOtEK4w8S5AHAq0tRR3QpL7D71DjkvHleQVR2EsLww7zpSVDYKSvakTdk 23YCCF9xMJ2iLDYYQ0JHHroqjtLyPfbH4QT2TDnvnYzRoSLrw/ey1mQoP1FyeJoR8SqD B3gxNK8t0XQ6hI/pbkULIoqDFuO9fO5fVLaSc1xJIJtKQv/B8XBsIlZ2oNoniPfy1g4t go7A== X-Gm-Message-State: AO0yUKVhMtGY3QrYSyzRWirlSzgdtX4V+8ZFn42+lrc06Uml3jLmAcb6 uRp+qoHSDMdbOHSaHCAM/KTPEZwMjlKTIXok X-Google-Smtp-Source: AK7set8NznXugpbZIw1//9OuEqlfohFItx9MuJMpUBNebPjGh0uWmUzv2ZI/efWAPif8VN7JIKwxEA== X-Received: by 2002:a05:600c:330f:b0:3e0:634:ff1b with SMTP id q15-20020a05600c330f00b003e00634ff1bmr764398wmp.4.1675710526887; Mon, 06 Feb 2023 11:08:46 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id p2-20020a05600c358200b003dc4ecfc4d7sm12538595wmq.29.2023.02.06.11.08.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Feb 2023 11:08:46 -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 v4 3/8] sequencer API users: fix get_replay_opts() leaks Date: Mon, 6 Feb 2023 20:08:08 +0100 Message-Id: X-Mailer: git-send-email 2.39.1.1425.ge02fe682bd8 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Make the replay_opts_release() function added in the preceding commit non-static, and use it for freeing the "struct replay_opts" constructed for "rebase" and "revert". 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 to call replay_opts_release() repeatedly. But let's fix this properly instead, by having the owner of the data free() it. 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 c97ce642cf3..2ec3ae0b42e 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -297,6 +297,7 @@ static int do_interactive_rebase(struct rebase_options *opts, unsigned flags) } cleanup: + replay_opts_release(&replay); free(revisions); free(shortrevisions); todo_list_release(&todo_list); @@ -338,6 +339,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: @@ -553,6 +555,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)) @@ -1324,6 +1327,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 b6392b43204..1547fb98597 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 Mon Feb 6 19:08: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: 13130517 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 B710DC05027 for ; Mon, 6 Feb 2023 19:08:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230103AbjBFTIx (ORCPT ); Mon, 6 Feb 2023 14:08:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229676AbjBFTIv (ORCPT ); Mon, 6 Feb 2023 14:08:51 -0500 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E77C12B2A8 for ; Mon, 6 Feb 2023 11:08:49 -0800 (PST) Received: by mail-wm1-x336.google.com with SMTP id z13so1934618wmp.2 for ; Mon, 06 Feb 2023 11:08:49 -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=96st8uUJULNn7PidqZM3pJY+/Zs5sHOjT2xbargMSv4=; b=ORO80ollm0P9PY1CAUhJXMAhfGYNlKyHYZHS767P0DJPnxNDy4YSZuNqdPnqSlvmTS b+zhMTKc+nVc2AcHsHmajpz3IqDNF6PvXNE/kaoN3IxwPzfwDKdPlH7TAtYptfDZenyk LAefnVB0v+VLvsmAUSfcIqLgiGFe3X68ID2oXjcH37eTq4aQ9K4edXegLgMoxYF73kLq D08IEMaU3PEgKG7Vrq7QjM+1mOrGSnPT6I66CmdbNmfWLij3hWExpRfm0Rl1K208pH98 juKIAww+TIGGFNZne+m4Cabq+uQkr/ew3+bb88X+TZAaew/D3jvG+caACQFFA63N+0M3 zeiQ== 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=96st8uUJULNn7PidqZM3pJY+/Zs5sHOjT2xbargMSv4=; b=hTudPg00OQUSmzGfbr8L44eB9XsyNgcJJo97J4XbUWzUh7n9dG6zYdieoT4zhSA5UO 4psTHMjuy8bh6rB2gVUmzPdbtOTDCBireyFIoBLAlavdeuOwcHVFgkBSI85Ns1xYPu/6 fLgZ7DSI+09MH55cumMRiwSB6tz8DmCqn6laB4BhCHRw5+l67kZSGh5B1bDSLkU991Lk mEPqhei5LG1KLYm3UlqBdTYPxskebjlpH7Ox/p4NE7aoHbPrzS94DTWW44z+cglN0OQY 0TuC8m1DmEO0HT0k7fXJ6Paj/mnmXvgwqreGs6PUC7bOg6gPPpKcCPicKzLf0WqVNw3c bdAQ== X-Gm-Message-State: AO0yUKX0bi/sI+jF4hd+BIFCGbOeiEtUGUGRmpRWDJPlYKSz7Nm5epRo LCdSbwgfzZr8x2qUbiwXcirVkXi0afT3lgBS X-Google-Smtp-Source: AK7set/plAJerPPGdoJ45sMtioweGkd3ETiiI30j98faCDZs/7hdBuYWUtwoLrH632BtJgW6hXt2Sw== X-Received: by 2002:a05:600c:a294:b0:3e0:10d:f1c with SMTP id hu20-20020a05600ca29400b003e0010d0f1cmr690338wmb.37.1675710528019; Mon, 06 Feb 2023 11:08:48 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id p2-20020a05600c358200b003dc4ecfc4d7sm12538595wmq.29.2023.02.06.11.08.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Feb 2023 11:08:47 -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 v4 4/8] builtin/revert.c: move free-ing of "revs" to replay_opts_release() Date: Mon, 6 Feb 2023 20:08:09 +0100 Message-Id: X-Mailer: git-send-email 2.39.1.1425.ge02fe682bd8 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 1547fb98597..cb4b1ce062c 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 Mon Feb 6 19:08: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: 13130525 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 2FAFEC636D3 for ; Mon, 6 Feb 2023 19:09:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230027AbjBFTJA (ORCPT ); Mon, 6 Feb 2023 14:09:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229873AbjBFTIv (ORCPT ); Mon, 6 Feb 2023 14:08:51 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C1C42A9AB for ; Mon, 6 Feb 2023 11:08:50 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id o36so9416470wms.1 for ; Mon, 06 Feb 2023 11:08:50 -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=ClUqrbfN1lOqJ3dDeEBpj0/8tmeSGIP4zG14gW9ffek=; b=SnooZAKNs2RAKHL6c0o0cdC38LVWpWSA3EVUwaaNABIAmMmb06rKLJo1vxQy6VJQAW PqGzE+5WJDj9qmUa29VNpRDhRKGeDZ5ACXWaFynogxAIDPaw4jvBuAo6rb3HvzhgiNCG 46GZ8mWB8vowA4QtZ7a9OllxdsG5zv2v2bwNorRveMY8gaEyKBTDOuXJ0bMy7lG1DU7T w8r2+Ktn444dM4+0kJO+658h0okv6rglQbPmZAmm9R9VbObH3EBODPbbT96Cu/1TAwzw IQQXarQPWx4nls0xQaeny1h9o11ApPhcFUjGABqxOHpcfwY8rNTyyYhH1+0nFwykU/ZQ kkzA== 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=ClUqrbfN1lOqJ3dDeEBpj0/8tmeSGIP4zG14gW9ffek=; b=lrZIGDC/XjDI6tkm/jIdgtR4dN4ePt/zb48QbtCKUWEAbrkXBCUi9VwIOdvK8vpacI 0wvqv9Svc+Hf8HUu38GwPnZDevVdmYQnpj9GEWq+74cfO21x7YwUByFOX7qCaWlXDztE odsFz4TiGSFOLVD+VuiGCkUMyqWi2SepJwyFJFLA8gijcT80XVDjB3kWH1fIgOhFrL1z 4F5xGtTBB3hEadCQUgSui4qP4jATNESVt21tq9SQ7whRHIomMiMc1dFWi8D//AnPUAYK +Wtby/SbXSWYU47krjPRaOF7m0nakSsE/eVvcUlUVFRhCKCZsPa9sAHEymRIVfzjlwkm 0Xjg== X-Gm-Message-State: AO0yUKVaV6AvfJyINj/AyYdDKRwRVBjC3aksGUuB+5ecU6CIhkcUmSeA zYrCPdkvdDAIyChlCrxCjgYQQgNR4hBjj11P X-Google-Smtp-Source: AK7set/zZEOpMUmAmWS1yY7Ea/BJAa/f5Bw+RG9RtxWa/jMmFH0GJw6s/QAleZk7mXOe5aopwJctpw== X-Received: by 2002:a05:600c:43c4:b0:3dd:1b76:347f with SMTP id f4-20020a05600c43c400b003dd1b76347fmr731934wmn.18.1675710529403; Mon, 06 Feb 2023 11:08:49 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id p2-20020a05600c358200b003dc4ecfc4d7sm12538595wmq.29.2023.02.06.11.08.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Feb 2023 11:08:48 -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 v4 5/8] builtin/rebase.c: fix "options.onto_name" leak Date: Mon, 6 Feb 2023 20:08:10 +0100 Message-Id: X-Mailer: git-send-email 2.39.1.1425.ge02fe682bd8 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 2ec3ae0b42e..41e96f0eb5a 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -1039,6 +1039,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; @@ -1675,7 +1676,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, "...")) { @@ -1851,6 +1852,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(&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 Mon Feb 6 19:08: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: 13130527 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 231FBC05027 for ; Mon, 6 Feb 2023 19:09:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230285AbjBFTJH (ORCPT ); Mon, 6 Feb 2023 14:09:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230214AbjBFTI7 (ORCPT ); Mon, 6 Feb 2023 14:08:59 -0500 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 860B32BF03 for ; Mon, 6 Feb 2023 11:08:51 -0800 (PST) Received: by mail-wm1-x336.google.com with SMTP id z13so1934684wmp.2 for ; Mon, 06 Feb 2023 11:08:51 -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=3FH5CnGvT3cO9J+OsZV/Kygt9niVnkntJ9qiB2eN/Dw=; b=n1tbzG6sgISAk8zjCy0pHJTPHswHlyjdz8IXcEXcchQikkdQcEVSChPEwwPcOVyJ7T 9niei7p79D+JUSU6eZz8kcUTDIPPnt9NOpovAFb3lyVmUr121iDQ7zC2DXoLSdEgs7t0 5LeCcso089YMpC6ZPIRvwsNah0cHiUHTay+4b0DhDx+lUavdRMdfoTM31RjlTH9epsJf SHogg6nF5B11V5/fKUskk2xez661fQyOWhBZ03O9eq74aGwQqQ4reMIu3ADx3J2W2Xol AZiHoQbOKSdDSzd2OyGabLHClcWmleSmXw+pZoSdMrs+TgI2URAhUxCM34fR+Q5kKUMz RkCg== 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=3FH5CnGvT3cO9J+OsZV/Kygt9niVnkntJ9qiB2eN/Dw=; b=61qLro7gwfGYf6ydU7QU0cElQDV3jmGCE9wrVNtyaDZ4dcrT7w5PdcvsYdyxnhki5/ MFsqZc8o3h92f/HiaEAXPx1C5UwIDEtrG5TudR2n0K32U4RltrkmhNiNn646U/mGYd0o 9bbqwzMrWo+BPYDlnQrMTa1iiL/lWfiwdIVVJMyl8O7/bfpf6lo96FxHEnJyhuyzIL+U OsUbAyZD2d1OBt18CobamFoy1ihV2E8dlK+Vrf1dKiK4Bk8TVvTrEtv5OlWzT8lDYjCL ZeGLvWHivvL1zp0ErtH3vrnq34UDjCpXBgGlppf7o8qxlurUEpBYJuDSvmgZbyxHz7E/ zyow== X-Gm-Message-State: AO0yUKVI9aMg90su1II2Nmf9t2wKhErAoxgINDYdpF9WdDu601/WMVwa Z8mvhs+miqAKoO9TnaHlpoiHwUsptcYcl6Py X-Google-Smtp-Source: AK7set9mNWdMUKtQQPGgQ1jxhmbbAQRX1fJWUNkTk5OLod9jtduldUtM7Csq5zo1HAmEb+DpcISbyA== X-Received: by 2002:a05:600c:1817:b0:3db:8de:6993 with SMTP id n23-20020a05600c181700b003db08de6993mr457741wmp.4.1675710530475; Mon, 06 Feb 2023 11:08:50 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id p2-20020a05600c358200b003dc4ecfc4d7sm12538595wmq.29.2023.02.06.11.08.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Feb 2023 11:08:50 -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 v4 6/8] sequencer.c: always free() the "msgbuf" in do_pick_commit() Date: Mon, 6 Feb 2023 20:08:11 +0100 Message-Id: X-Mailer: git-send-email 2.39.1.1425.ge02fe682bd8 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 cb4b1ce062c..fb23f734ade 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 Mon Feb 6 19:08: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: 13130526 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 4326EC636D3 for ; Mon, 6 Feb 2023 19:09:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230260AbjBFTJG (ORCPT ); Mon, 6 Feb 2023 14:09:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230220AbjBFTI7 (ORCPT ); Mon, 6 Feb 2023 14:08:59 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1B272BF27 for ; Mon, 6 Feb 2023 11:08:52 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id o36so9416543wms.1 for ; Mon, 06 Feb 2023 11:08:52 -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=0u0DG9ekKTnC7dnAUsx1H6cOzDLAKEJT+uig94+QfqU=; b=CtXUVlAnLlbKvJd1AEFnVk1XgTdeGygIMSFpLE9fFh6dWwLq//GLCm1UhbZXFmvp99 JziNtI0kbLQ43sekQeFeP6yMNb4WaixzqqD3R+Vy1QG4IRHJClMc1MhVViT5phhNJ2u8 woUXjmiGKYHEKSSR009ntiS0tBzf7noLoE8wlqK9Ze7F1NknkV6ncV7mTPdvSmq8Xw8u zqu0TIDK7AZ2TwODDoBXN2vcy7I6L3lFTF8cDp9g60d8Q5pVbYwNBeooSFzk0FNE3Vph HLAd3Mfhs1gJX6Q141P5QWmHFv+tYlAXQlyCnk1ZmoKmQ+Bn+PAo286im8y2EAgGValM VB7w== 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=0u0DG9ekKTnC7dnAUsx1H6cOzDLAKEJT+uig94+QfqU=; b=2gtOLvBnMxDdY06M7CUlvpkKAOJP4u8hM3UacOAbil+Q6UpSG/hve0XNDvLT0e1YoA sdEFLabXcx+knKAtajucysTwDv/ulY/XlRUiZgVzlGii+6pWTrRr/W5eIIv8HC6ovyWs ECyhKCXKL3fBTLKYE+1PnNw4oM7ePNTxgvBPfGf4jvhLqPpf5nyGorcwCKIa+DPoZSvS D2JkHseJZYhZ0b9jyja7YfSH6Ya76NJAHfjhc/aWceuzzoFyAMf7Jnxj0th89FNN/qZ3 UM1AD4u0ZonSWk1G12G5eMgevFC3XC/zZqboxaed9hM32VY9gwmQjv2BRZ8yAYT4U7Ha +egw== X-Gm-Message-State: AO0yUKWf0AZSeOecsTX7qX/2FheKUWAVeZ0jn1IsoKRcP4Va5J53GHw2 rOVePFKkCBQayqAyQ1wJhwqTMlKaQUtULwEj X-Google-Smtp-Source: AK7set+MUIuRwkD8ExR2l5EZL0oukIlCQb34BKtwBlsNCFQ0V/0QVErh0f61DJ9FOj2PHtSkao55iw== X-Received: by 2002:a05:600c:181d:b0:3db:9e3:3bf1 with SMTP id n29-20020a05600c181d00b003db09e33bf1mr695099wmp.31.1675710531736; Mon, 06 Feb 2023 11:08:51 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id p2-20020a05600c358200b003dc4ecfc4d7sm12538595wmq.29.2023.02.06.11.08.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Feb 2023 11:08:50 -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 v4 7/8] builtin/rebase.c: free() "options.strategy_opts" Date: Mon, 6 Feb 2023 20:08:12 +0100 Message-Id: X-Mailer: git-send-email 2.39.1.1425.ge02fe682bd8 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 41e96f0eb5a..6635f10d529 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -1850,6 +1850,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) free(options.gpg_sign_opt); string_list_clear(&options.exec, 0); 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 Mon Feb 6 19:08: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: 13130528 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 537B9C05027 for ; Mon, 6 Feb 2023 19:09:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230307AbjBFTJO (ORCPT ); Mon, 6 Feb 2023 14:09:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230178AbjBFTJF (ORCPT ); Mon, 6 Feb 2023 14:09:05 -0500 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF2CC2CC7C for ; Mon, 6 Feb 2023 11:08:54 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id bg26so9431249wmb.0 for ; Mon, 06 Feb 2023 11:08:54 -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=ck9bc+uHj9NGRA8qszXQ7UP5VhmZcGVCNviift5n4BY=; b=Res16T5yIgmzpwuKzxa6P5vHxtfu4cdsm/jKyglGBnkw4I3WGE0aQGdZg7uahoquPj Hdzc8DUuAjllv7zJsNDg8Vld2mZ5Ty9EykwVXH3p6jq9Odtt7+j1g1/XzqQ7Wyo+gm5/ Wcjh1NBACY++kIIDeRZ4EqKiukkGnWgtUo5pVf/k7x0Wbm5EDnfS3hDmP7nrOYDCYZxL 06+5QQ4sf0HNYFrIjOd9/nyAUDt1j/sF3Td6RqxGoVBnTlBX2tzI0Qql77bKRPKhSRvI IDJk6MDIDPV33nCVzud6NGl3RUb/jjolbsABHtSwZHD4Slg74x2wkXZePQ5xzS6GslPn RkMA== 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=ck9bc+uHj9NGRA8qszXQ7UP5VhmZcGVCNviift5n4BY=; b=2R2R6zP1YoNxpQOm4oYLoS6d++2OMRIqqTBiSEZyE8xJ7OJ4beRQWipq3tyZgEbMd8 R2A0gWzAYeUsCp9Il+LPHIZseHz0GlYF2Qqa7Vd54PHemy7s72Dmz/fkPHFuzmQncPki 6LakcWuHP9rh8cZr9iVAQB4UaEeAHJe+VFYSwz9k6Uh2laiB6mK8ACuSI5gP3ZBfsAis lY03FH3xUGWMtlu6PVXBfEAKSxsHv1NtskZgbPZ2w3Yccc9C+Sb9lhGR8b4x6l2tKkK9 FCcJ37eJRp0198i1IPdSXJf4mlvgJzW/jQJbqczx3YdfdKdb/xuU31Q4aqz98yaZ/Adv 4euQ== X-Gm-Message-State: AO0yUKXwWvJJEyW7mdJZGWEKFiUn7eYJTY+fAFcFekuQ/CwWABoUJaT/ Z6pzg+rOBZfOpNCSY4c7ZYAuifZmQG5VGAts X-Google-Smtp-Source: AK7set+ZIzc/MRGEcHMQwBbAbYhRIKR9oBFc691v8ay8I/l+gwCEuLzXj2i8RREK/hpW+kFE3sJjmA== X-Received: by 2002:a05:600c:4da4:b0:3df:ea09:fcc9 with SMTP id v36-20020a05600c4da400b003dfea09fcc9mr449106wmp.7.1675710532844; Mon, 06 Feb 2023 11:08:52 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id p2-20020a05600c358200b003dc4ecfc4d7sm12538595wmq.29.2023.02.06.11.08.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Feb 2023 11:08:52 -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 v4 8/8] commit.c: free() revs.commit in get_fork_point() Date: Mon, 6 Feb 2023 20:08:13 +0100 Message-Id: X-Mailer: git-send-email 2.39.1.1425.ge02fe682bd8 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 '