projects
/
git.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c752e7f
)
commit-tree: free commit message before exiting
author
Jonathan Nieder
<jrnieder@gmail.com>
Sat, 2 Oct 2010 08:41:00 +0000
(
03:41
-0500)
committer
Junio C Hamano
<gitster@pobox.com>
Thu, 7 Oct 2010 03:30:17 +0000
(20:30 -0700)
This buffer is freed by the C runtime when commit-tree exits moments
later, but freeing it explicitly should make valgrind quieter.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/commit-tree.c
patch
|
blob
|
history
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
@@
-56,10
+56,12
@@
int cmd_commit_tree(int argc, const char **argv, const char *prefix)
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;
}