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>
robfitz@273k.net committed
Oct 8, 2005 at 15:54 UTC
f22ca7c50d79fcfd769ddcda988e0981fb883a16
1 file changed
+10
server-info.c
+10
@@ -59,6 +59,16 @@ static struct object *parse_object_cheap(const unsigned char *sha1)
59
struct commit *commit = (struct commit *)o;
60
free(commit->buffer);
61
commit->buffer = NULL;
62
+ } else if (o->type == tree_type) {
63
+ struct tree *tree = (struct tree *)o;
64
+ struct tree_entry_list *e, *n;
65
+ for (e = tree->entries; e; e = n) {
66
+ free(e->name);
67
+ e->name = NULL;
68
+ n = e->next;
69
+ free(e);
70
+ }
71
+ tree->entries = NULL;
72
}
73
return o;
74
}