this patch fixes a memory leak in write-tree.c's write_tree() function -
we didnt free the temporary output buffer. Depending on the size of the
tree written out this could leak a significant amount of RAM.
Ingo
Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
--- write-tree.c.orig
+++ write-tree.c
@@ -33,12 +33,12 @@ static int write_tree(struct cache_entry
{
unsigned char subdir_sha1[20];
unsigned long size, offset;
- char *buffer;
+ char *buffer0, *buffer;
int i, nr;
/* Guess at some random initial size */
size = 8192;
- buffer = malloc(size);
+ buffer0 = buffer = malloc(size);
offset = ORIG_OFFSET;
nr = 0;
@@ -97,6 +97,8 @@ static int write_tree(struct cache_entry
offset -= i;
write_sha1_file(buffer, offset, returnsha1);
+ free(buffer0);
+
return nr;
}
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html