[PATCH] git cat-file: Fix memory leak in batch mode

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Junio C Hamano <gitster@...>
Cc: Avery Pennarun <apenwarr@...>, Eric Wong <normalperson@...>, Adam Roben <aroben@...>, Samuel Bronson <naesten@...>, <git@...>
Date: Saturday, June 28, 2008 - 9:21 pm

When run in batch mode, git cat-file never frees the memory for the blob
contents it is printing. This quickly adds up and causes git-svn to be
hardly usable for imports of large svn repos, because it uses cat-file in
batch mode and cat-file's memory usage easily reaches several hundred MB
without any good reason.

Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
---
 builtin-cat-file.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/builtin-cat-file.c b/builtin-cat-file.c
index bd343ef..f966dcb 100644
--- a/builtin-cat-file.c
+++ b/builtin-cat-file.c
@@ -183,6 +183,7 @@ static int batch_one_object(const char *obj_name, int print_contents)
 		fflush(stdout);
 	}
 
+	free(contents);
 	return 0;
 }
 
-- 
1.5.6.1.94.gd3899.dirty
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
git-svn messed up import, badly, Björn, (Sat Jun 28, 3:48 pm)
[PATCH] Revert "git-svn: Speed up fetch", Avery Pennarun, (Sat Jun 28, 4:57 pm)
Re: [PATCH] Revert "git-svn: Speed up fetch", Mikael Magnusson, (Sat Jun 28, 7:51 pm)
Re: [PATCH] Revert "git-svn: Speed up fetch", Avery Pennarun, (Sat Jun 28, 7:58 pm)
[PATCH] git cat-file: Fix memory leak in batch mode, Björn, (Sat Jun 28, 9:21 pm)
Re: [PATCH] git cat-file: Fix memory leak in batch mode, Junio C Hamano, (Sat Jun 28, 11:36 pm)