Code

git-filter-branch: document --original option
[git.git] / object.c
index 37d1363359eb54070ed4dc52b9e96d4ad9457db3..16793d9958a57664233b9e4468e112dfa1a8a915 100644 (file)
--- a/object.c
+++ b/object.c
@@ -160,8 +160,11 @@ struct object *parse_object_buffer(const unsigned char *sha1, enum object_type t
                parse_tag_buffer(tag, buffer, size);
                obj = &tag->object;
        } else {
+               warning("object %s has unknown type id %d\n", sha1_to_hex(sha1), type);
                obj = NULL;
        }
+       if (obj && obj->type == OBJ_NONE)
+               obj->type = type;
        *eaten_p = eaten;
        return obj;
 }
@@ -176,6 +179,7 @@ struct object *parse_object(const unsigned char *sha1)
        if (buffer) {
                struct object *obj;
                if (check_sha1_signature(sha1, buffer, size, typename(type)) < 0) {
+                       free(buffer);
                        error("sha1 mismatch %s\n", sha1_to_hex(sha1));
                        return NULL;
                }