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 <B.Steinbrink@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Björn Steinbrink committed
Jun 29, 2008 at 03:21 UTC
5b8a94b1db4beba969d8cbb0e6e45033834b5913
1 file changed
+1
builtin-cat-file.c
+1
@@ -181,6 +181,7 @@ static int batch_one_object(const char *obj_name, int print_contents)
181
write_or_die(1, contents, size);
182
printf("\n");
183
fflush(stdout);
184
+ free(contents);
185
}
186
187
return 0;