Merge branch 'ds/ewah-cleanup'
[gitweb.git] / tag.c
diff --git a/tag.c b/tag.c
index 3d37c1bd251c5f8c5eb06ede72ab57b323888709..3be7206e92063d4f4f561488e2203a5edd18760d 100644 (file)
--- a/tag.c
+++ b/tag.c
@@ -1,8 +1,10 @@
 #include "cache.h"
 #include "tag.h"
+#include "object-store.h"
 #include "commit.h"
 #include "tree.h"
 #include "blob.h"
+#include "alloc.h"
 #include "gpg-interface.h"
 
 const char *tag_type = "tag";
@@ -93,7 +95,8 @@ struct tag *lookup_tag(const struct object_id *oid)
 {
        struct object *obj = lookup_object(oid->hash);
        if (!obj)
-               return create_object(oid->hash, alloc_tag_node());
+               return create_object(the_repository, oid->hash,
+                                    alloc_tag_node(the_repository));
        return object_as_type(obj, OBJ_TAG, 0);
 }
 
@@ -114,6 +117,14 @@ static timestamp_t parse_tag_date(const char *buf, const char *tail)
        return parse_timestamp(dateptr, NULL, 10);
 }
 
+void release_tag_memory(struct tag *t)
+{
+       free(t->tag);
+       t->tagged = NULL;
+       t->object.parsed = 0;
+       t->date = 0;
+}
+
 int parse_tag_buffer(struct tag *item, const void *data, unsigned long size)
 {
        struct object_id oid;