]> git.ipfire.org Git - thirdparty/git.git/commit
builtin/rebase: fix leaking `commit.gpgsign` value
authorPatrick Steinhardt <ps@pks.im>
Wed, 14 Aug 2024 06:52:17 +0000 (08:52 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 14 Aug 2024 17:07:58 +0000 (10:07 -0700)
commit1ca57bea4a8a4637c4e7d2a2f46677acc4795d81
treec0eb8403992b218344a0a36a30c58b5ce3ffeb66
parent648abbe22d55a6004bf6dafa7c0ed209572c9fe9
builtin/rebase: fix leaking `commit.gpgsign` value

In `get_replay_opts()`, we override the `gpg_sign` field that already
got populated by `sequencer_init_config()` in case the user has
"commit.gpgsign" set in their config. This creates a memory leak because
we overwrite the previously assigned value, which may have already
pointed to an allocated string.

Let's plug the memory leak by freeing the value before we overwrite it.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/rebase.c
sequencer.c
t/t3404-rebase-interactive.sh
t/t3435-rebase-gpg-sign.sh
t/t7030-verify-tag.sh