Make "struct tree" contain the pointer to the tree buffer
[git.git] / builtin-rev-list.c
index f11dbd6..72c1549 100644 (file)
@@ -103,6 +103,7 @@ static struct object_list **process_blob(struct blob *blob,
        if (obj->flags & (UNINTERESTING | SEEN))
                return p;
        obj->flags |= SEEN;
+       name = strdup(name);
        return add_object(obj, p, path, name);
 }
 
@@ -122,6 +123,7 @@ static struct object_list **process_tree(struct tree *tree,
        if (parse_tree(tree) < 0)
                die("bad tree object %s", sha1_to_hex(obj->sha1));
        obj->flags |= SEEN;
+       name = strdup(name);
        p = add_object(obj, p, path, name);
        me.up = path;
        me.elem = name;
@@ -137,6 +139,8 @@ static struct object_list **process_tree(struct tree *tree,
                free(entry);
                entry = next;
        }
+       free(tree->buffer);
+       tree->buffer = NULL;
        return p;
 }