diff --git a/builtin/commit-tree.c b/builtin/commit-tree.c
index 87f0591c2f68a03e06c73b352282426b803450ba..732f8952bb2e6a03415e15a046f3c62df7f63a0d 100644 (file)
--- a/builtin/commit-tree.c
+++ b/builtin/commit-tree.c
if (strbuf_read(&buffer, 0, 0) < 0)
die_errno("git commit-tree: failed to read");
- if (!commit_tree(buffer.buf, tree_sha1, parents, commit_sha1, NULL)) {
- printf("%s\n", sha1_to_hex(commit_sha1));
- return 0;
- }
- else
+ if (commit_tree(buffer.buf, tree_sha1, parents, commit_sha1, NULL)) {
+ strbuf_release(&buffer);
return 1;
+ }
+
+ printf("%s\n", sha1_to_hex(commit_sha1));
+ strbuf_release(&buffer);
+ return 0;
}