pack-objects: check realloc in try_delta with GITERR_CHECK_ALLOC
diff --git a/src/pack-objects.c b/src/pack-objects.c
index 0afa28e..5d9c09d 100644
--- a/src/pack-objects.c
+++ b/src/pack-objects.c
@@ -850,9 +850,11 @@ static int try_delta(git_packbuilder *pb, struct unpacked *trg,
git_packbuilder__cache_unlock(pb);
- if (overflow ||
- !(trg_object->delta_data = git__realloc(delta_buf, delta_size)))
+ if (overflow)
return -1;
+
+ trg_object->delta_data = git__realloc(delta_buf, delta_size);
+ GITERR_CHECK_ALLOC(trg_object->delta_data);
} else {
/* create delta when writing the pack */
git_packbuilder__cache_unlock(pb);