Skip to content

Commit 42aae6a

Browse files
phillipwoodgitster
authored andcommitted
sequencer: always free "struct replay_opts"
sequencer_post_commit_cleanup() initializes an instance of "struct replay_opts" but does not call replay_opts_release(). Currently this does not leak memory because the code paths called don't allocate any of the struct members. That will change in the next commit so add call to replay_opts_release() to prevent a memory leak in "git commit" that breaks all of the leak free tests. Signed-off-by: Phillip Wood <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2a60cb7 commit 42aae6a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

sequencer.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2823,12 +2823,14 @@ void sequencer_post_commit_cleanup(struct repository *r, int verbose)
28232823
NULL, REF_NO_DEREF);
28242824

28252825
if (!need_cleanup)
2826-
return;
2826+
goto out;
28272827

28282828
if (!have_finished_the_last_pick())
2829-
return;
2829+
goto out;
28302830

28312831
sequencer_remove_state(&opts);
2832+
out:
2833+
replay_opts_release(&opts);
28322834
}
28332835

28342836
static void todo_list_write_total_nr(struct todo_list *todo_list)

0 commit comments

Comments
 (0)