setup: refactor `upgrade_repository_format()` to have common exit
commit4ce14e13250e824b7d410d9bff88061525346a15
authorPatrick Steinhardt <ps@pks.im>
Mon, 6 Nov 2023 10:46:01 +0000 (6 11:46 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 6 Nov 2023 23:51:41 +0000 (7 08:51 +0900)
treec578e7692c54d36998f4a02e1e4e7a9fd2cfec42
parent568cc818cc26955eb0b94084d3068caabab1edd7
setup: refactor `upgrade_repository_format()` to have common exit

The `upgrade_repository_format()` function has multiple exit paths,
which means that there is no common cleanup of acquired resources.
While this isn't much of a problem right now, we're about to fix a
memory leak that would require us to free the resource in every one of
those exit paths.

Refactor the code to have a common exit path so that the subsequent
memory leak fix becomes easier to implement.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
setup.c