diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-07-15 10:35:04 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-07-15 10:35:04 -0700 |
commit | 1b790212efc238bc7c94417d4b19a5b11e3dd541 (patch) | |
tree | d9023faedb223104c35bed166c358445f67e03df | |
parent | 8ca36db01371b67293f85ca66d8a022f4a8477a3 (diff) | |
parent | 706728a37c53c3d1c3fc38aa9c9842060d03e9cc (diff) | |
download | git-1b790212efc238bc7c94417d4b19a5b11e3dd541.tar.gz |
Merge branch 'fc/sequencer-plug-leak' into maint
"cherry-pick" had a small leak in its error codepath.
* fc/sequencer-plug-leak:
sequencer: avoid leaking message buffer when refusing to create an empty commit
sequencer: remove useless indentation
-rw-r--r-- | sequencer.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/sequencer.c b/sequencer.c index ab6f8a722d..f7be7d8be6 100644 --- a/sequencer.c +++ b/sequencer.c @@ -474,7 +474,7 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts) struct commit_message msg = { NULL, NULL, NULL, NULL, NULL }; char *defmsg = NULL; struct strbuf msgbuf = STRBUF_INIT; - int res, unborn = 0; + int res, unborn = 0, allow; if (opts->no_commit) { /* @@ -624,14 +624,18 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts) msg.subject); print_advice(res == 1, opts); rerere(opts->allow_rerere_auto); - } else { - int allow = allow_empty(opts, commit); - if (allow < 0) - return allow; - if (!opts->no_commit) - res = run_git_commit(defmsg, opts, allow); + goto leave; + } + + allow = allow_empty(opts, commit); + if (allow < 0) { + res = allow; + goto leave; } + if (!opts->no_commit) + res = run_git_commit(defmsg, opts, allow); +leave: free_message(&msg); free(defmsg); |