summaryrefslogtreecommitdiff
path: root/src/odb.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2022-02-07 11:22:04 -0500
committerEdward Thomson <ethomson@edwardthomson.com>2022-02-07 11:22:04 -0500
commitc19a3c7a23a972e25e013cff300343323e65a55f (patch)
tree9d1b0147e2f06857d66762147b37e44df751ee5a /src/odb.c
parentd9863fc19eed8135f2fbcc4ee22ea950dcd6fddf (diff)
downloadlibgit2-c19a3c7a23a972e25e013cff300343323e65a55f.tar.gz
odb: check for write failures
Diffstat (limited to 'src/odb.c')
-rw-r--r--src/odb.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/odb.c b/src/odb.c
index 156d03076..3abeae280 100644
--- a/src/odb.c
+++ b/src/odb.c
@@ -1501,10 +1501,10 @@ int git_odb_write(
if ((error = git_odb_open_wstream(&stream, db, len, type)) != 0)
return error;
- stream->write(stream, data, len);
- error = stream->finalize_write(stream, oid);
- git_odb_stream_free(stream);
+ if ((error = stream->write(stream, data, len)) == 0)
+ error = stream->finalize_write(stream, oid);
+ git_odb_stream_free(stream);
return error;
}