Skip to content

Commit

Permalink
git cat-file: Fix memory leak in batch mode
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Björn Steinbrink authored and Junio C Hamano committed Jun 29, 2008
1 parent 762656e commit 5b8a94b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions builtin-cat-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5b8a94b

Please sign in to comment.