Skip to content

Commit

Permalink
Merge branch 'fc/sequencer-plug-leak' into maint
Browse files Browse the repository at this point in the history
"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
  • Loading branch information
Junio C Hamano committed Jul 15, 2013
2 parents 8ca36db + 706728a commit 1b79021
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions sequencer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
/*
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 1b79021

Please sign in to comment.