update-ref --stdin: make error messages more consistent
[gitweb.git] / sha1_file.c
index b37c6f67e4d97b95b4fb070aa03992eb92506421..400aa463a47c504feec3ca508e7340c6d5dc8268 100644 (file)
@@ -2288,6 +2288,10 @@ void *unpack_entry(struct packed_git *p, off_t obj_offset,
        *final_size = size;
 
        unuse_pack(&w_curs);
+
+       if (delta_stack != small_delta_stack)
+               free(delta_stack);
+
        return data;
 }
 
@@ -2631,12 +2635,7 @@ int pretend_sha1_file(void *buf, unsigned long len, enum object_type type,
        hash_sha1_file(buf, len, typename(type), sha1);
        if (has_sha1_file(sha1) || find_cached_object(sha1))
                return 0;
-       if (cached_object_alloc <= cached_object_nr) {
-               cached_object_alloc = alloc_nr(cached_object_alloc);
-               cached_objects = xrealloc(cached_objects,
-                                         sizeof(*cached_objects) *
-                                         cached_object_alloc);
-       }
+       ALLOC_GROW(cached_objects, cached_object_nr + 1, cached_object_alloc);
        co = &cached_objects[cached_object_nr++];
        co->size = len;
        co->type = type;