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>
This commit is contained in:

committed by
Taylor Blau

parent
e693ccf2c9
commit
4abc8022ff
@ -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;
|
||||
|
Reference in New Issue
Block a user