From 5b8a94b1db4beba969d8cbb0e6e45033834b5913 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bj=C3=B6rn=20Steinbrink?= Date: Sun, 29 Jun 2008 03:21:25 +0200 Subject: [PATCH] git cat-file: Fix memory leak in batch mode MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Junio C Hamano --- builtin-cat-file.c | 1 + 1 file changed, 1 insertion(+) diff --git a/builtin-cat-file.c b/builtin-cat-file.c index bd343efae..880e75af5 100644 --- a/builtin-cat-file.c +++ b/builtin-cat-file.c @@ -181,6 +181,7 @@ static int batch_one_object(const char *obj_name, int print_contents) write_or_die(1, contents, size); printf("\n"); fflush(stdout); + free(contents); } return 0; -- 2.26.2