summaryrefslogtreecommitdiff
path: root/write-tree.c
diff options
context:
space:
mode:
authorBrad Roberts <braddr@puremagic.com>2005-04-17 10:55:12 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-17 10:55:12 -0700
commit7223a88ce7795f38f47812ebca4433e7f8b82a30 (patch)
treef55c811b9064810830cc746ac4d201abcd6a5f3c /write-tree.c
parente8871e88adca0637eb0299a41d85400beac928bd (diff)
downloadgit-7223a88ce7795f38f47812ebca4433e7f8b82a30.tar.gz
[PATCH] fix for memory leak in write-tree.c
Fix a memory leak in write-tree.c, not freeing the directory buffer.
Diffstat (limited to 'write-tree.c')
-rw-r--r--write-tree.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/write-tree.c b/write-tree.c
index b58871c7d9..827809dbdd 100644
--- a/write-tree.c
+++ b/write-tree.c
@@ -93,10 +93,8 @@ static int write_tree(struct cache_entry **cachep, int maxentries, const char *b
i -= 5;
memcpy(buffer+i, "tree ", 5);
- buffer += i;
- offset -= i;
-
- write_sha1_file(buffer, offset, returnsha1);
+ write_sha1_file(buffer + i, offset - i, returnsha1);
+ free(buffer);
return nr;
}