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
This commit is contained in:
Junio C Hamano 2013-07-15 10:35:04 -07:00
commit 1b790212ef

View File

@ -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 }; struct commit_message msg = { NULL, NULL, NULL, NULL, NULL };
char *defmsg = NULL; char *defmsg = NULL;
struct strbuf msgbuf = STRBUF_INIT; struct strbuf msgbuf = STRBUF_INIT;
int res, unborn = 0; int res, unborn = 0, allow;
if (opts->no_commit) { if (opts->no_commit) {
/* /*
@ -624,14 +624,18 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts)
msg.subject); msg.subject);
print_advice(res == 1, opts); print_advice(res == 1, opts);
rerere(opts->allow_rerere_auto); rerere(opts->allow_rerere_auto);
} else { goto leave;
int allow = allow_empty(opts, commit);
if (allow < 0)
return allow;
if (!opts->no_commit)
res = run_git_commit(defmsg, opts, allow);
} }
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_message(&msg);
free(defmsg); free(defmsg);