diff options
author | Junio C Hamano <gitster@pobox.com> | 2024-04-01 13:21:35 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-04-01 13:21:35 -0700 |
commit | f949703f4b0a89704f45ccd8552334d1627949b9 (patch) | |
tree | 798ce2eb5daa9a28097fc60b1f6c6dcab90307d0 | |
parent | f0c570e20b1adcb0ab2ed5d61d3c762ea4bf86e3 (diff) | |
parent | 647e870a08e31984f5f42703f3618ff378a72932 (diff) | |
download | git-f949703f4b0a89704f45ccd8552334d1627949b9.tar.gz |
Merge branch 'jk/rebase-apply-leakfix'
Leakfix.
* jk/rebase-apply-leakfix:
rebase: use child_process_clear() to clean
-rw-r--r-- | builtin/rebase.c | 6 | ||||
-rwxr-xr-x | t/t3438-rebase-broken-files.sh | 9 |
2 files changed, 12 insertions, 3 deletions
diff --git a/builtin/rebase.c b/builtin/rebase.c index e444ab102d..b9d0fb3269 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -610,7 +610,7 @@ static int run_am(struct rebase_options *opts) status = error_errno(_("could not open '%s' for writing"), rebased_patches); free(rebased_patches); - strvec_clear(&am.args); + child_process_clear(&am); return status; } @@ -638,7 +638,7 @@ static int run_am(struct rebase_options *opts) struct reset_head_opts ropts = { 0 }; unlink(rebased_patches); free(rebased_patches); - strvec_clear(&am.args); + child_process_clear(&am); ropts.oid = &opts->orig_head->object.oid; ropts.branch = opts->head_name; @@ -659,7 +659,7 @@ static int run_am(struct rebase_options *opts) status = error_errno(_("could not open '%s' for reading"), rebased_patches); free(rebased_patches); - strvec_clear(&am.args); + child_process_clear(&am); return status; } diff --git a/t/t3438-rebase-broken-files.sh b/t/t3438-rebase-broken-files.sh index c614c4f2e4..821f08e5af 100755 --- a/t/t3438-rebase-broken-files.sh +++ b/t/t3438-rebase-broken-files.sh @@ -58,4 +58,13 @@ test_expect_success 'unknown key in author-script' ' check_resolve_fails ' +test_expect_success POSIXPERM,SANITY 'unwritable rebased-patches does not leak' ' + >.git/rebased-patches && + chmod a-w .git/rebased-patches && + + git checkout -b side HEAD^ && + test_commit unrelated && + test_must_fail git rebase --apply --onto tmp HEAD^ +' + test_done |