pack-objects: fix memory leak on overflow
diff --git a/src/pack-objects.c b/src/pack-objects.c
index 46fe8f3..11e13f7 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);