From 4abc8022ffae64bb24e93153c75bc880991bb2dc Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Thu, 17 Oct 2024 06:54:08 +0200 Subject: reftable/record: adapt `reftable_record_key()` to handle allocation failures The `reftable_record_key()` function cannot pass any errors to the caller as it has a `void` return type. Adapt it and its callers such that we can handle errors and start handling allocation failures. Signed-off-by: Patrick Steinhardt Signed-off-by: Taylor Blau --- reftable/reader.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'reftable/reader.c') diff --git a/reftable/reader.c b/reftable/reader.c index 388f8bf6d7..ab89efd9c5 100644 --- a/reftable/reader.c +++ b/reftable/reader.c @@ -356,7 +356,9 @@ static int table_iter_seek_linear(struct table_iter *ti, int err; reftable_record_init(&rec, reftable_record_type(want)); - reftable_record_key(want, &want_key); + err = reftable_record_key(want, &want_key); + if (err < 0) + goto done; /* * First we need to locate the block that must contain our record. To @@ -439,7 +441,9 @@ static int table_iter_seek_indexed(struct table_iter *ti, }; int err; - reftable_record_key(rec, &want_index.u.idx.last_key); + err = reftable_record_key(rec, &want_index.u.idx.last_key); + if (err < 0) + goto done; /* * The index may consist of multiple levels, where each level may have -- cgit v1.3