diff options
| author | Patrick Steinhardt <ps@pks.im> | 2024-08-14 08:52:17 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-08-14 10:07:58 -0700 |
| commit | 1ca57bea4a8a4637c4e7d2a2f46677acc4795d81 (patch) | |
| tree | c0eb8403992b218344a0a36a30c58b5ce3ffeb66 /builtin/rebase.c | |
| parent | config: fix leaking comment character config (diff) | |
| download | git-1ca57bea4a8a4637c4e7d2a2f46677acc4795d81.tar.gz git-1ca57bea4a8a4637c4e7d2a2f46677acc4795d81.zip | |
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>
Diffstat (limited to 'builtin/rebase.c')
| -rw-r--r-- | builtin/rebase.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/builtin/rebase.c b/builtin/rebase.c index e3a8e74cfc..2f01d5d3a6 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -186,6 +186,7 @@ static struct replay_opts get_replay_opts(const struct rebase_options *opts) replay.committer_date_is_author_date = opts->committer_date_is_author_date; replay.ignore_date = opts->ignore_date; + free(replay.gpg_sign); replay.gpg_sign = xstrdup_or_null(opts->gpg_sign_opt); replay.reflog_action = xstrdup(opts->reflog_action); if (opts->strategy) |
