Commit 60dd319
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 <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>1 parent 7e892fe commit 60dd319
1 file changed
+15
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
152 | 164 | | |
153 | 165 | | |
154 | | - | |
155 | | - | |
156 | | - | |
| 166 | + | |
157 | 167 | | |
158 | 168 | | |
159 | 169 | | |
| |||
643 | 653 | | |
644 | 654 | | |
645 | 655 | | |
646 | | - | |
647 | | - | |
648 | | - | |
649 | | - | |
| 656 | + | |
650 | 657 | | |
651 | 658 | | |
652 | 659 | | |
653 | 660 | | |
654 | 661 | | |
655 | | - | |
| 662 | + | |
656 | 663 | | |
657 | 664 | | |
658 | 665 | | |
| |||
0 commit comments