vendor/libgit2/src/pack-objects.c in rugged-0.24.0b13 vs vendor/libgit2/src/pack-objects.c in rugged-0.24.0b14
- old
+ new
@@ -627,14 +627,12 @@
git_oid entry_oid;
unsigned int i = 0;
int error = 0;
write_order = compute_write_order(pb);
- if (write_order == NULL) {
- error = -1;
- goto done;
- }
+ if (write_order == NULL)
+ return -1;
/* Write pack header */
ph.hdr_signature = htonl(PACK_SIGNATURE);
ph.hdr_version = htonl(PACK_VERSION);
ph.hdr_entries = htonl(pb->nr_objects);
@@ -848,12 +846,14 @@
bool overflow = git__add_uint64_overflow(
&pb->delta_cache_size, pb->delta_cache_size, delta_size);
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);
git__free(delta_buf);
}