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 <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Phillip Wood committed Apr 18, 2024 at 14:14 UTC 42aae6a49af1be6108c3133af881cb9429aa3d35
1 file changed +4 -2
sequencer.c
+4 -2
@@ -2823,12 +2823,14 @@ void sequencer_post_commit_cleanup(struct repository *r, int verbose)
2823 NULL, REF_NO_DEREF);
2824
2825 if (!need_cleanup)
2826 - return;
2826 + goto out;
2827
2828 if (!have_finished_the_last_pick())
2829 - return;
2829 + goto out;
2830
2831 sequencer_remove_state(&opts);
2832 +out:
2833 + replay_opts_release(&opts);
2834 }
2835
2836 static void todo_list_write_total_nr(struct todo_list *todo_list)