aboutsummaryrefslogtreecommitdiff
path: root/sequencer.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-07-09 11:34:05 -0700
committerJunio C Hamano <gitster@pobox.com>2014-07-09 11:34:05 -0700
commit3b8e8af187cb86ed030432f1a067121fdd4b1c3b (patch)
treedd8cdaa18cfd70d6cfe6b0a3120fccb5f0a971cd /sequencer.c
parente91ae32a01ffe294b8510c1d8cd7138493a0712f (diff)
parentcb6c38d5cce7d8d48a57346b332a68cea1489df1 (diff)
downloadgit-3b8e8af187cb86ed030432f1a067121fdd4b1c3b.tar.gz
git-3b8e8af187cb86ed030432f1a067121fdd4b1c3b.tar.xz
Merge branch 'jk/xstrfmt'
* jk/xstrfmt: setup_git_env(): introduce git_path_from_env() helper unique_path: fix unlikely heap overflow walker_fetch: fix minor memory leak merge: use argv_array when spawning merge strategy sequencer: use argv_array_pushf setup_git_env: use git_pathdup instead of xmalloc + sprintf use xstrfmt to replace xmalloc + strcpy/strcat use xstrfmt to replace xmalloc + sprintf use xstrdup instead of xmalloc + strcpy use xstrfmt in favor of manual size calculations strbuf: add xstrfmt helper
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/sequencer.c b/sequencer.c
index c513d7eeb..cdd30c073 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -361,18 +361,13 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts,
{
struct argv_array array;
int rc;
- char *gpg_sign;
argv_array_init(&array);
argv_array_push(&array, "commit");
argv_array_push(&array, "-n");
- if (opts->gpg_sign) {
- gpg_sign = xmalloc(3 + strlen(opts->gpg_sign));
- sprintf(gpg_sign, "-S%s", opts->gpg_sign);
- argv_array_push(&array, gpg_sign);
- free(gpg_sign);
- }
+ if (opts->gpg_sign)
+ argv_array_pushf(&array, "-S%s", opts->gpg_sign);
if (opts->signoff)
argv_array_push(&array, "-s");
if (!opts->edit) {