aboutsummaryrefslogtreecommitdiffstats
path: root/reftable/writer.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/writer.c
parente693ccf2c9427dfd5d93db723ac68f49f550ed38 (diff)
downloadgit-4abc8022ffae64bb24e93153c75bc880991bb2dc.tar.gz
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/writer.c')
-rw-r--r--reftable/writer.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/reftable/writer.c b/reftable/writer.c
index da6941a78a..377db709c8 100644
--- a/reftable/writer.c
+++ b/reftable/writer.c
@@ -249,7 +249,10 @@ static int writer_add_record(struct reftable_writer *w,
struct reftable_buf key = REFTABLE_BUF_INIT;
int err;
- reftable_record_key(rec, &key);
+ err = reftable_record_key(rec, &key);
+ if (err < 0)
+ goto done;
+
if (reftable_buf_cmp(&w->last_key, &key) >= 0) {
err = REFTABLE_API_ERROR;
goto done;