summaryrefslogtreecommitdiff
path: root/src/blob.c
diff options
context:
space:
mode:
authorSergey Nikishin <nordsturm@yandex-team.ru>2011-04-24 18:33:50 +0400
committerSergey Nikishin <nordsturm@yandex-team.ru>2011-04-24 18:43:08 +0400
commit1d1735fe03a53482c6545252bd567555d5d9b487 (patch)
tree5479fb536bb09e1e4c88a8100a8c038f39253253 /src/blob.c
parent411823a3d0614d1268c84bd2add1b65b281ec824 (diff)
downloadlibgit2-1d1735fe03a53482c6545252bd567555d5d9b487.tar.gz
Add error processing in git_blob_create_frombuffer()
Diffstat (limited to 'src/blob.c')
-rw-r--r--src/blob.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/blob.c b/src/blob.c
index 5e3c22fb..69a0b954 100644
--- a/src/blob.c
+++ b/src/blob.c
@@ -64,7 +64,10 @@ int git_blob_create_frombuffer(git_oid *oid, git_repository *repo, const void *b
if ((error = git_odb_open_wstream(&stream, repo->db, len, GIT_OBJ_BLOB)) < GIT_SUCCESS)
return error;
- stream->write(stream, buffer, len);
+ if ((error = stream->write(stream, buffer, len)) < GIT_SUCCESS) {
+ stream->free(stream);
+ return error;
+ }
error = stream->finalize_write(oid, stream);
stream->free(stream);