]> git.ipfire.org Git - thirdparty/git.git/commitdiff
sequencer: fix a memory leak in sequencer_continue()
authorAlban Gruin <alban.gruin@gmail.com>
Thu, 28 Nov 2019 23:02:03 +0000 (00:02 +0100)
committerJunio C Hamano <gitster@pobox.com>
Sat, 30 Nov 2019 17:40:35 +0000 (09:40 -0800)
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>
sequencer.c

index 34ebf8ed94ad7d8df6773337d31ff7d9c2c84c4a..cc037776bf5bee1cbadb0ce4e01571b59aaa8dba 100644 (file)
@@ -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)))