diff-tree -r -t: include added/removed directories in the output
[gitweb.git] / list-objects.c
index e5c88c278fe23eefbf4cb4dd0c66251b208e48bd..dd243c7c662c2f3fe9463b616bb00bed2cc503a7 100644 (file)
@@ -18,10 +18,11 @@ static void process_blob(struct rev_info *revs,
 
        if (!revs->blob_objects)
                return;
+       if (!obj)
+               die("bad blob object");
        if (obj->flags & (UNINTERESTING | SEEN))
                return;
        obj->flags |= SEEN;
-       name = xstrdup(name);
        add_object(obj, p, path, name);
 }
 
@@ -69,12 +70,13 @@ static void process_tree(struct rev_info *revs,
 
        if (!revs->tree_objects)
                return;
+       if (!obj)
+               die("bad tree object");
        if (obj->flags & (UNINTERESTING | SEEN))
                return;
        if (parse_tree(tree) < 0)
                die("bad tree object %s", sha1_to_hex(obj->sha1));
        obj->flags |= SEEN;
-       name = xstrdup(name);
        add_object(obj, p, path, name);
        me.up = path;
        me.elem = name;
@@ -170,4 +172,11 @@ void traverse_commit_list(struct rev_info *revs,
        }
        for (i = 0; i < objects.nr; i++)
                show_object(&objects.objects[i]);
+       free(objects.objects);
+       if (revs->pending.nr) {
+               free(revs->pending.objects);
+               revs->pending.nr = 0;
+               revs->pending.alloc = 0;
+               revs->pending.objects = NULL;
+       }
 }