Subject: Re: [PATCH 00/13] reftable: prepare for re-seekable iterators

From: Junio C Hamano <[email-masked]>
Date: Wed, 08 May 2024 17:16:47 -0700

Junio C Hamano <[email-masked]> writes:

> diff --git c/reftable/reader.c w/reftable/reader.c
> index 2ea830bdb6..fd516e01db 100644
> --- c/reftable/reader.c
> +++ w/reftable/reader.c
> @@ -841,7 +841,7 @@ int reftable_reader_print_blocks(const char *tablename)
>  		},
>  	};
>  	struct reftable_block_source src = { 0 };
> -	struct table_iter ti = TABLE_ITER_INIT;
> +	struct table_iter *ti;
>  	struct reftable_reader *r = NULL;
>  	size_t i;
>  	int err;

... an unusually early error could skip everything here ...

> @@ -880,6 +883,6 @@ int reftable_reader_print_blocks(const char *tablename)
>  
>  done:
>  	reftable_reader_free(r);
> -	table_iter_close(&ti);
> +	table_iter_close(ti);

... and cause this to break.  In the version of the merge-fix I
used, *ti is initialized to NULL and the _close() is called only
when ti is not NULL.

>  	return err;
>  }