Reduce memory usage in git-update-server-info.

Modify parse_object_cheap() to also free all the entries from the tree
data structures.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
robfitz@273k.net 2005-10-08 15:54:35 -07:00 committed by Junio C Hamano
parent 230f13225d
commit f22ca7c50d

View File

@ -59,6 +59,16 @@ static struct object *parse_object_cheap(const unsigned char *sha1)
struct commit *commit = (struct commit *)o; struct commit *commit = (struct commit *)o;
free(commit->buffer); free(commit->buffer);
commit->buffer = NULL; commit->buffer = NULL;
} else if (o->type == tree_type) {
struct tree *tree = (struct tree *)o;
struct tree_entry_list *e, *n;
for (e = tree->entries; e; e = n) {
free(e->name);
e->name = NULL;
n = e->next;
free(e);
}
tree->entries = NULL;
} }
return o; return o;
} }