aboutsummaryrefslogtreecommitdiffstats
path: root/reftable/blocksource.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-02-16 15:14:27 -0800
committerJunio C Hamano <gitster@pobox.com>2022-02-16 15:14:28 -0800
commit34230514b83f55ea0f4531e8486533ac5c3e2ffe (patch)
treef1c51b9380a93f2d6abdb9ab25489faedbe59c93 /reftable/blocksource.c
parentMerge branch 'll/doc-mktree-typofix' (diff)
parentreftable: add print functions to the record types (diff)
downloadgit-34230514b83f55ea0f4531e8486533ac5c3e2ffe.tar.gz
git-34230514b83f55ea0f4531e8486533ac5c3e2ffe.zip
Merge branch 'hn/reftable-coverity-fixes'
Problems identified by Coverity in the reftable code have been corrected. * hn/reftable-coverity-fixes: reftable: add print functions to the record types reftable: make reftable_record a tagged union reftable: remove outdated file reftable.c reftable: implement record equality generically reftable: make reftable-record.h function signatures const correct reftable: handle null refnames in reftable_ref_record_equal reftable: drop stray printf in readwrite_test reftable: order unittests by complexity reftable: all xxx_free() functions accept NULL arguments reftable: fix resource warning reftable: ignore remove() return value in stack_test.c reftable: check reftable_stack_auto_compact() return value reftable: fix resource leak blocksource.c reftable: fix resource leak in block.c error path reftable: fix OOB stack write in print functions
Diffstat (limited to 'reftable/blocksource.c')
-rw-r--r--reftable/blocksource.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/reftable/blocksource.c b/reftable/blocksource.c
index 0044eecd9a..2605371c28 100644
--- a/reftable/blocksource.c
+++ b/reftable/blocksource.c
@@ -134,8 +134,10 @@ int reftable_block_source_from_file(struct reftable_block_source *bs,
}
err = fstat(fd, &st);
- if (err < 0)
- return -1;
+ if (err < 0) {
+ close(fd);
+ return REFTABLE_IO_ERROR;
+ }
p = reftable_calloc(sizeof(struct file_block_source));
p->size = st.st_size;