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)
|
if (strbuf_read(&buffer, 0, 0) < 0)
|
||||||
die_errno("git commit-tree: failed to read");
|
die_errno("git commit-tree: failed to read");
|
||||||
|
|
||||||
if (!commit_tree(buffer.buf, tree_sha1, parents, commit_sha1, NULL)) {
|
if (commit_tree(buffer.buf, tree_sha1, parents, commit_sha1, NULL)) {
|
||||||
printf("%s\n", sha1_to_hex(commit_sha1));
|
strbuf_release(&buffer);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%s\n", sha1_to_hex(commit_sha1));
|
||||||
|
strbuf_release(&buffer);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user