summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrobfitz@273k.net <robfitz@273k.net>2005-10-08 22:54:35 (GMT)
committerJunio C Hamano <junkio@cox.net>2005-10-08 22:54:35 (GMT)
commitf22ca7c50d79fcfd769ddcda988e0981fb883a16 (patch)
tree0e19abdb8d4c523c1cd3a5369e292a3acfaeaa41
parent230f13225df8b7e7eb0acc91a8c630f9e84967c1 (diff)
downloadgit-f22ca7c50d79fcfd769ddcda988e0981fb883a16.zip
git-f22ca7c50d79fcfd769ddcda988e0981fb883a16.tar.gz
git-f22ca7c50d79fcfd769ddcda988e0981fb883a16.tar.bz2
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>
-rw-r--r--server-info.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/server-info.c b/server-info.c
index a9e5607..3c08a28 100644
--- a/server-info.c
+++ b/server-info.c
@@ -59,6 +59,16 @@ static struct object *parse_object_cheap(const unsigned char *sha1)
struct commit *commit = (struct commit *)o;
free(commit->buffer);
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;
}