t/helper/test-fast-rebase.c: don't leak "struct strbuf"

Fix a memory leak that's been with us since f9500261e0a (fast-rebase: write conflict state to working tree, index, and HEAD, 2021-05-20) changed this code to move these strbuf_release() into an if/else block. We'll also add to "reflog_msg" in the "else" arm of the "if" block being modified here, and we'll append to "branch_msg" in both cases. But after f9500261e0a only the "if" block would free these two "struct strbuf". Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Apr 13, 2022 at 22:01 UTC b925fcf12951dba85313afd08c6154d8d978b03e
1 file changed +3 -2
t/helper/test-fast-rebase.c
+3 -2
@@ -201,8 +201,6 @@ int cmd__fast_rebase(int argc, const char **argv)
201 }
202 if (create_symref("HEAD", branch_name.buf, reflog_msg.buf) < 0)
203 die(_("unable to update HEAD"));
204 - strbuf_release(&reflog_msg);
205 - strbuf_release(&branch_name);
204
205 prime_cache_tree(the_repository, the_repository->index,
206 result.tree);
@@ -221,5 +219,8 @@ int cmd__fast_rebase(int argc, const char **argv)
219 if (write_locked_index(&the_index, &lock,
220 COMMIT_LOCK | SKIP_IF_UNCHANGED))
221 die(_("unable to write %s"), get_index_file());
222 +
223 + strbuf_release(&reflog_msg);
224 + strbuf_release(&branch_name);
225 return (result.clean == 0);
226 }