mirror of
https://github.com/git/git
synced 2024-08-28 03:59:25 +00:00
Merge branch 'ab/commit-plug-leaks'
Leakfix in the top-level called-once function. * ab/commit-plug-leaks: commit: fix "author_ident" leak
This commit is contained in:
commit
ea78f9ee7a
|
@ -1687,6 +1687,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
|
||||||
struct commit *current_head = NULL;
|
struct commit *current_head = NULL;
|
||||||
struct commit_extra_header *extra = NULL;
|
struct commit_extra_header *extra = NULL;
|
||||||
struct strbuf err = STRBUF_INIT;
|
struct strbuf err = STRBUF_INIT;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
if (argc == 2 && !strcmp(argv[1], "-h"))
|
if (argc == 2 && !strcmp(argv[1], "-h"))
|
||||||
usage_with_options(builtin_commit_usage, builtin_commit_options);
|
usage_with_options(builtin_commit_usage, builtin_commit_options);
|
||||||
|
@ -1721,8 +1722,9 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
|
||||||
running hooks, writing the trees, and interacting with the user. */
|
running hooks, writing the trees, and interacting with the user. */
|
||||||
if (!prepare_to_commit(index_file, prefix,
|
if (!prepare_to_commit(index_file, prefix,
|
||||||
current_head, &s, &author_ident)) {
|
current_head, &s, &author_ident)) {
|
||||||
|
ret = 1;
|
||||||
rollback_index_files();
|
rollback_index_files();
|
||||||
return 1;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Determine parents */
|
/* Determine parents */
|
||||||
|
@ -1820,7 +1822,6 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
|
||||||
rollback_index_files();
|
rollback_index_files();
|
||||||
die(_("failed to write commit object"));
|
die(_("failed to write commit object"));
|
||||||
}
|
}
|
||||||
strbuf_release(&author_ident);
|
|
||||||
free_commit_extra_headers(extra);
|
free_commit_extra_headers(extra);
|
||||||
|
|
||||||
if (update_head_with_reflog(current_head, &oid, reflog_msg, &sb,
|
if (update_head_with_reflog(current_head, &oid, reflog_msg, &sb,
|
||||||
|
@ -1862,7 +1863,9 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
|
||||||
|
|
||||||
apply_autostash(git_path_merge_autostash(the_repository));
|
apply_autostash(git_path_merge_autostash(the_repository));
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
UNLEAK(author_ident);
|
||||||
UNLEAK(err);
|
UNLEAK(err);
|
||||||
UNLEAK(sb);
|
UNLEAK(sb);
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
test_description='Intent to add'
|
test_description='Intent to add'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success 'intent to add' '
|
test_expect_success 'intent to add' '
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
test_description='skip-worktree bit test'
|
test_description='skip-worktree bit test'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
cat >expect.full <<EOF
|
cat >expect.full <<EOF
|
||||||
|
|
Loading…
Reference in a new issue