From: Björn Steinbrink Date: Sun, 29 Jun 2008 01:21:25 +0000 (+0200) Subject: git cat-file: Fix memory leak in batch mode X-Git-Tag: v1.5.6.2~12 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=5b8a94b1db4beba969d8cbb0e6e45033834b5913;p=git.git git cat-file: Fix memory leak in batch mode 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 --- 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;