{"thread":{"id":"52369","subject":"[PATCH v1 1/1] sequencer: fix a memory leak in sequencer_continue()","startedAt":"2019-11-28T23:02:21Z","lastAt":"2019-11-28T23:02:21Z","messageCount":1,"participants":["Alban Gruin"],"isPatch":true,"patchVersion":1,"patchTotal":1},"messages":[{"id":"387296","messageId":"20191128230203.26058-1-alban.gruin@gmail.com","threadId":"52369","inReplyTo":null,"subject":"[PATCH v1 1/1] sequencer: fix a memory leak in sequencer_continue()","fromName":"Alban Gruin","fromEmail":"alban.gruin@gmail.com","sentAt":"2019-11-28T23:02:03Z","receivedAt":"2019-11-28T23:02:21Z","isPatch":true,"sender":{"key":"alban.gruin@gmail.com","avatar":"https://avatars.githubusercontent.com/u/6310153?v=4"},"body":"When continuing an interactive rebase after a merge conflict was solved,\nif the resolution could not be committed, sequencer_continue() would\nreturn early without releasing its todo list, resulting in a memory\nleak.  This plugs this leak by jumping to the end of the function, where\nthe todo list is deallocated.\n\nSigned-off-by: Alban Gruin <alban.gruin@gmail.com>\n---\nI found this while adding support of rebase.missingCommitCheck to `git\nrebase --continue'.\n\n sequencer.c | 6 ++++--\n 1 file changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/sequencer.c b/sequencer.c\nindex 8952cfa89b..64227a71e5 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -4208,8 +4208,10 @@ int sequencer_continue(struct repository *r, struct replay_opts *opts)\n \tif (is_rebase_i(opts)) {\n \t\tif ((res = read_populate_todo(r, &todo_list, opts)))\n \t\t\tgoto release_todo_list;\n-\t\tif (commit_staged_changes(r, opts, &todo_list))\n-\t\t\treturn -1;\n+\t\tif (commit_staged_changes(r, opts, &todo_list)) {\n+\t\t\tres = -1;\n+\t\t\tgoto release_todo_list;\n+\t\t}\n \t} else if (!file_exists(get_todo_path(opts)))\n \t\treturn continue_single_pick(r);\n \telse if ((res = read_populate_todo(r, &todo_list, opts)))\n-- \n2.24.0\n\n"}]}