sequencer: assign only free()able strings to gpg_sign

The gpg_sign member of the replay_opts structure is of type `char *`,
meaning that the sequencer deems the string to which gpg_sign points to
be under its custody, i.e. it needs to be free()d by the sequencer.

Therefore, let's only assign malloc()ed buffers to it.

Reported-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Johannes Schindelin
2017-12-22 12:50:50 +01:00
committed by Junio C Hamano
parent 28d6daed4f
commit ed1e52822e
2 changed files with 11 additions and 1 deletions

View File

@ -160,7 +160,7 @@ static int git_sequencer_config(const char *k, const char *v, void *cb)
}
if (!strcmp(k, "commit.gpgsign")) {
opts->gpg_sign = git_config_bool(k, v) ? "" : NULL;
opts->gpg_sign = git_config_bool(k, v) ? xstrdup("") : NULL;
return 0;
}