aboutsummaryrefslogtreecommitdiff
path: root/reftable/reader.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-10-17 06:54:08 +0200
committerTaylor Blau <me@ttaylorr.com>2024-10-17 16:59:56 -0400
commit4abc8022ffae64bb24e93153c75bc880991bb2dc (patch)
treeba63e3e1e4a25962e13e70a79d610646da4e7120 /reftable/reader.c
parente693ccf2c9427dfd5d93db723ac68f49f550ed38 (diff)
downloadgit-4abc8022ffae64bb24e93153c75bc880991bb2dc.tar.xz
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 <ps@pks.im> Signed-off-by: Taylor Blau <me@ttaylorr.com>
Diffstat (limited to 'reftable/reader.c')
-rw-r--r--reftable/reader.c8
1 files changed, 6 insertions, 2 deletions
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