Skip to content

Commit 1e7c8b1

Browse files
authored
Merge pull request libgit2#6206 from libgit2/ethomson/odb_write_failures
odb: check for write failures
2 parents d9863fc + c19a3c7 commit 1e7c8b1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/odb.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,10 +1501,10 @@ int git_odb_write(
15011501
if ((error = git_odb_open_wstream(&stream, db, len, type)) != 0)
15021502
return error;
15031503

1504-
stream->write(stream, data, len);
1505-
error = stream->finalize_write(stream, oid);
1506-
git_odb_stream_free(stream);
1504+
if ((error = stream->write(stream, data, len)) == 0)
1505+
error = stream->finalize_write(stream, oid);
15071506

1507+
git_odb_stream_free(stream);
15081508
return error;
15091509
}
15101510

0 commit comments

Comments
 (0)