diff options
author | Patrick Steinhardt <ps@pks.im> | 2024-04-08 14:24:25 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-04-08 17:01:41 -0700 |
commit | 60dd319519b41cc5cc79bdef5ee8556297db6984 (patch) | |
tree | 35117448ce7d6d36cd65d6414838bac8606fc269 /builtin/commit.c | |
parent | 7e892fec47645ce0b791da468fb4df6c9c6d9f37 (diff) |
reftable/writer: unify releasing memory
There are two code paths which release memory of the reftable writer:
- `reftable_writer_close()` releases internal state after it has
written data.
- `reftable_writer_free()` releases the block that was written to and
the writer itself.
Both code paths free different parts of the writer, and consequently the
caller must make sure to call both. And while callers mostly do this
already, this falls apart when a write failure causes the caller to skip
calling `reftable_write_close()`.
Introduce a new function `reftable_writer_release()` that releases all
internal state and call it from both paths. Like this it is fine for the
caller to not call `reftable_writer_close()`.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/commit.c')
0 files changed, 0 insertions, 0 deletions