summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-08-20 23:42:26 -0700
committerJunio C Hamano <gitster@pobox.com>2008-08-20 23:42:26 -0700
commit83a1abb37d2dc8ac18731bd53da9522e6641f0a1 (patch)
treedafbb8ca47570be4637553177407c0f798d87c85
parent16cccd8bff6c0cf2700b169215a831ac63d6b145 (diff)
parentffa9fd957039902c9a08946d82ccb729a34ed68b (diff)
downloadgit-83a1abb37d2dc8ac18731bd53da9522e6641f0a1.tar.gz
Merge branch 'sb/commit-tree-minileak'
* sb/commit-tree-minileak: Fix commit_tree() buffer leak
-rw-r--r--builtin-commit-tree.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/builtin-commit-tree.c b/builtin-commit-tree.c
index 7a9a309be0..f773db596c 100644
--- a/builtin-commit-tree.c
+++ b/builtin-commit-tree.c
@@ -48,6 +48,7 @@ static const char commit_utf8_warn[] =
int commit_tree(const char *msg, unsigned char *tree,
struct commit_list *parents, unsigned char *ret)
{
+ int result;
int encoding_is_utf8;
struct strbuf buffer;
@@ -86,7 +87,9 @@ int commit_tree(const char *msg, unsigned char *tree,
if (encoding_is_utf8 && !is_utf8(buffer.buf))
fprintf(stderr, commit_utf8_warn);
- return write_sha1_file(buffer.buf, buffer.len, commit_type, ret);
+ result = write_sha1_file(buffer.buf, buffer.len, commit_type, ret);
+ strbuf_release(&buffer);
+ return result;
}
int cmd_commit_tree(int argc, const char **argv, const char *prefix)