diff options
| author | Jeff King <peff@peff.net> | 2026-06-28 05:03:14 -0400 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-06-28 08:35:06 -0700 |
| commit | c6fb3b9c3ec6ca16ba2fbed154b41b22e5a088f0 (patch) | |
| tree | 9e747b7cb5246e26db62e307591fcf32e97eefd1 /t/t4013/diff.diff_initial..side | |
| parent | 94f057755b7941b321fd11fec1b2e3ca5313a4e0 (diff) | |
reftable: fix unlikely leak on API error
If the reftable writer sees a bogus block size, we return with
REFTABLE_API_ERROR, leaking the reftable_writer struct we previously
allocated. Originally this case was a BUG(), but it became a regular
return in 445f9f4f35 (reftable: stop using `BUG()` in trivial cases,
2025-02-18).
We could obviously fix it by calling "reftable_free(wp)". But we can
observe that we never use the allocated "wp" until after we've validated
the input options. So let's just bump the allocation down. That fixes
the leak, and I think makes the flow of the function more logical
(we validate our inputs before doing any work).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4013/diff.diff_initial..side')
0 files changed, 0 insertions, 0 deletions
