1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-04-27 15:15:09 +02:00

Merge branch 'jk/rebase-apply-leakfix' into next

Leakfix.

* jk/rebase-apply-leakfix:
  rebase: use child_process_clear() to clean
This commit is contained in:
Junio C Hamano 2024-03-25 16:26:51 -07:00
commit f9358272af
2 changed files with 12 additions and 3 deletions

View File

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

View File

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