On Wed, Apr 03, 2024 at 06:16:35AM -0700, Karthik Nayak wrote: > Patrick Steinhardt <ps@xxxxxx> writes: > > > > diff --git a/reftable/reader.c b/reftable/reader.c > > index f70efa2b7c..f925570bf3 100644 > > --- a/reftable/reader.c > > +++ b/reftable/reader.c > > @@ -253,7 +253,7 @@ static void table_iter_block_done(struct table_iter *ti) > > if (!ti->bi.br) { > > return; > > } > > - reftable_block_done(&ti->bi.br->block); > > + block_reader_release(ti->bi.br); > > FREE_AND_NULL(ti->bi.br); > > > > ti->bi.last_key.len = 0; > > I would expect `FREE_AND_NULL(ti->bi.br)` to also be within > `block_reader_release`, but then you'd have to pass `table_iter` or > `**`. So I guess this is okay. It is customary in the Git codebase to discern `release` and `free` functions. `release` will release all memory hosted by a structure, but will not release the structure itself. `free` on the other hand is expected to free both the memory hosted by a structure, and the structure itself. `block_reader_release()` thus shouldn't free the `struct block_reader`. Patrick
Attachment:
signature.asc
Description: PGP signature