mktree: fix a memory leak in write_tree()
authorLiu Yuan <tailai.ly@taobao.com>
Thu, 10 Nov 2011 08:39:22 +0000 (16:39 +0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 10 Nov 2011 17:04:08 +0000 (09:04 -0800)
We forget to call strbuf_release to release the buf memory.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
mktree.c
index 2e84889c02dd110caff0e896a6899f877ca863f1..bb23c4425b483317c3cbe4775c10b967a2822af4 100644 (file)
--- a/mktree.c
+++ b/mktree.c
@@ -61,6 +61,7 @@ static void write_tree(unsigned char *sha1)
        }
 
        write_sha1_file(buf.buf, buf.len, tree_type, sha1);
+       strbuf_release(&buf);
 }
 
 static const char mktree_usage[] = "git-mktree [-z]";