summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2016-03-01 17:55:40 +0100
committerPatrick Steinhardt <ps@pks.im>2016-03-11 12:14:02 +0100
commit3fe5768b061f319a4f8fa55c25614a31767d2208 (patch)
tree4adebf89423af558df97a777d782e1e3296c4b70
parent80a834a5af6f8ea70b9f4e8657fa80da124c5693 (diff)
downloadlibgit2-3fe5768b061f319a4f8fa55c25614a31767d2208.tar.gz
pack-objects: fix memory leak on overflow
-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 46fe8f3db..11e13f7d4 100644
--- a/src/pack-objects.c
+++ b/src/pack-objects.c
@@ -848,8 +848,10 @@ static int try_delta(git_packbuilder *pb, struct unpacked *trg,
git_packbuilder__cache_unlock(pb);
- if (overflow)
+ if (overflow) {
+ git__free(delta_buf);
return -1;
+ }
trg_object->delta_data = git__realloc(delta_buf, delta_size);
GITERR_CHECK_ALLOC(trg_object->delta_data);