mirror of
https://github.com/git/git
synced 2024-08-27 11:39:22 +00:00
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:
parent
c752e7f3e8
commit
79bc2af5ae
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue