reftable/reader: be more careful about errors in indexed seeks

When doing an indexed seek we first need to do a linear seek in order to find the index block for our wanted key. We do not check the returned error of the linear seek though. This is likely not an issue because the next call to `table_iter_next()` would return error, too. But it very much is a code smell when an error variable is being assigned to without actually checking it. Safeguard the code by checking for errors. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed Feb 1, 2024 at 08:51 UTC d55fc5128b26a64c2e7b6612d0442c9e924696e8
1 file changed +3
reftable/reader.c
+3
@@ -509,6 +509,9 @@ static int reader_seek_indexed(struct reftable_reader *r,
509 goto done;
510
511 err = reader_seek_linear(&index_iter, &want_index);
512 + if (err < 0)
513 + goto done;
514 +
515 while (1) {
516 err = table_iter_next(&index_iter, &index_result);
517 table_iter_block_done(&index_iter);