git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Reduce memory usage in git-update-server-info.
@ 2005-10-06 22:49 robfitz
  0 siblings, 0 replies; only message in thread
From: robfitz @ 2005-10-06 22:49 UTC (permalink / raw)
  To: git; +Cc: Robert Fitzsimons

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

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>

---

 server-info.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

applies-to: fc843c89d12160dfe9704e7a0dd678cc729459cb
67be887f195205e36c7eec39b9caea249a435e95
diff --git a/server-info.c b/server-info.c
--- a/server-info.c
+++ b/server-info.c
@@ -59,6 +59,16 @@ static struct object *parse_object_cheap
 		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;
 }
---
0.99.8.GIT

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-10-06 22:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-06 22:49 [PATCH] Reduce memory usage in git-update-server-info robfitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).