]> Kevux Git Server - rit/commit
midx-write: use cleanup when incremental midx fails
authorDerrick Stolee <stolee@gmail.com>
Fri, 5 Sep 2025 19:26:15 +0000 (19:26 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 5 Sep 2025 19:32:00 +0000 (12:32 -0700)
commit9c2262d65dee8c1e3656b01f7db0660181902d2a
tree6b80b7bfc8948dbd6f0489efe3457b7700dcd207
parent3a45c7beb0f66bad122a1c319c71add5533e1f00
midx-write: use cleanup when incremental midx fails

The incremental mode of writing a multi-pack-index has a few extra
conditions that could lead to failure, but these are currently
short-ciruiting with 'return -1' instead of setting the method's
'result' variable and going to the cleanup tag.

Replace these returns with gotos to avoid memory issues when exiting
early due to error conditions.

Unfortunately, these error conditions are difficult to reproduce with
test cases, which is perhaps one reason why the memory loss was not
caught by existing test cases in memory tracking modes.

Signed-off-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
midx-write.c