summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2020-02-07 12:13:42 +0100
committerPatrick Steinhardt <ps@pks.im>2020-02-07 13:08:23 +0100
commitb169cd522e796de3d47d5725d73ab5a0ed88ccf6 (patch)
treede3f4113d3ddb749f4a4ebaab75a3398b0bd6698 /src
parent90450d8825e01e2deb24e0f9bd244a9efe243528 (diff)
downloadlibgit2-b169cd522e796de3d47d5725d73ab5a0ed88ccf6.tar.gz
pack-objects: check return code of `git_zstream_set_input`
While `git_zstream_set_input` cannot fail right now, it might change in the future if we ever decide to have it check its parameters more vigorously. Let's thus check whether its return code signals an error.
Diffstat (limited to 'src')
-rw-r--r--src/pack-objects.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/pack-objects.c b/src/pack-objects.c
index bdd5171a8..49b4e4772 100644
--- a/src/pack-objects.c
+++ b/src/pack-objects.c
@@ -374,7 +374,9 @@ static int write_object(
GIT_ERROR_CHECK_ALLOC(zbuf);
git_zstream_reset(&pb->zstream);
- git_zstream_set_input(&pb->zstream, data, data_len);
+
+ if ((error = git_zstream_set_input(&pb->zstream, data, data_len)) < 0)
+ goto done;
while (!git_zstream_done(&pb->zstream)) {
if ((error = git_zstream_get_output(zbuf, &zbuf_len, &pb->zstream)) < 0 ||