summaryrefslogtreecommitdiff
path: root/sequencer.c
diff options
context:
space:
mode:
authorAlban Gruin <alban.gruin@gmail.com>2019-11-28 23:02:03 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-11-30 17:40:35 (GMT)
commitf6b9413bafbe22202007f9c891082c1df82fce52 (patch)
treeb7629ce047c8f6f1020b5983f18051253ea49867 /sequencer.c
parent5fa0f5238b0cd46cfe7f6fa76c3f526ea98148d9 (diff)
downloadgit-f6b9413bafbe22202007f9c891082c1df82fce52.zip
git-f6b9413bafbe22202007f9c891082c1df82fce52.tar.gz
git-f6b9413bafbe22202007f9c891082c1df82fce52.tar.bz2
sequencer: fix a memory leak in sequencer_continue()
When continuing an interactive rebase after a merge conflict was solved, if the resolution could not be committed, sequencer_continue() would return early without releasing its todo list, resulting in a memory leak. This plugs this leak by jumping to the end of the function, where the todo list is deallocated. Signed-off-by: Alban Gruin <alban.gruin@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sequencer.c b/sequencer.c
index 34ebf8e..cc03777 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -4256,8 +4256,10 @@ int sequencer_continue(struct repository *r, struct replay_opts *opts)
if (is_rebase_i(opts)) {
if ((res = read_populate_todo(r, &todo_list, opts)))
goto release_todo_list;
- if (commit_staged_changes(r, opts, &todo_list))
- return -1;
+ if (commit_staged_changes(r, opts, &todo_list)) {
+ res = -1;
+ goto release_todo_list;
+ }
} else if (!file_exists(get_todo_path(opts)))
return continue_single_pick(r);
else if ((res = read_populate_todo(r, &todo_list, opts)))