Skip to content

Commit

Permalink
Reduce memory usage in git-update-server-info.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
robfitz@273k.net authored and Junio C Hamano committed Oct 8, 2005
1 parent 230f132 commit f22ca7c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions server-info.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit f22ca7c

Please sign in to comment.