commit-tree: free commit message before exiting

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>
This commit is contained in:
Jonathan Nieder 2010-10-02 03:41:00 -05:00 committed by Junio C Hamano
parent c752e7f3e8
commit 79bc2af5ae

View file

@ -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;
}