Skip to content

Commit 1b79021

Browse files
committed
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
2 parents 8ca36db + 706728a commit 1b79021

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

sequencer.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts)
474474
struct commit_message msg = { NULL, NULL, NULL, NULL, NULL };
475475
char *defmsg = NULL;
476476
struct strbuf msgbuf = STRBUF_INIT;
477-
int res, unborn = 0;
477+
int res, unborn = 0, allow;
478478

479479
if (opts->no_commit) {
480480
/*
@@ -624,14 +624,18 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts)
624624
msg.subject);
625625
print_advice(res == 1, opts);
626626
rerere(opts->allow_rerere_auto);
627-
} else {
628-
int allow = allow_empty(opts, commit);
629-
if (allow < 0)
630-
return allow;
631-
if (!opts->no_commit)
632-
res = run_git_commit(defmsg, opts, allow);
627+
goto leave;
628+
}
629+
630+
allow = allow_empty(opts, commit);
631+
if (allow < 0) {
632+
res = allow;
633+
goto leave;
633634
}
635+
if (!opts->no_commit)
636+
res = run_git_commit(defmsg, opts, allow);
634637

638+
leave:
635639
free_message(&msg);
636640
free(defmsg);
637641

0 commit comments

Comments
 (0)