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>
This commit is contained in:
committed by
Junio C Hamano
parent
648abbe22d
commit
1ca57bea4a
@@ -303,6 +303,7 @@ static int git_sequencer_config(const char *k, const char *v,
|
||||
}
|
||||
|
||||
if (!strcmp(k, "commit.gpgsign")) {
|
||||
free(opts->gpg_sign);
|
||||
opts->gpg_sign = git_config_bool(k, v) ? xstrdup("") : NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user