Merge branch 'jk/setup-revisions-freefix'

There are double frees and leaks around setup_revisions() API used
in "git stash show", which has been fixed, and setup_revisions()
API gained a wrapper to make it more ergonomic when using it with
strvec-manged argc/argv pairs.

* jk/setup-revisions-freefix:
  revision: retain argv NULL invariant in setup_revisions()
  treewide: pass strvecs around for setup_revisions_from_strvec()
  treewide: use setup_revisions_from_strvec() when we have a strvec
  revision: add wrapper to setup_revisions() from a strvec
  revision: manage memory ownership of argv in setup_revisions()
  stash: tell setup_revisions() to free our allocated strings
This commit is contained in:
Junio C Hamano
2025-09-29 11:40:34 -07:00
17 changed files with 85 additions and 42 deletions

View File

@@ -1741,4 +1741,13 @@ test_expect_success 'submodules does not affect the branch recorded in stash mes
)
'
test_expect_success SANITIZE_LEAK 'stash show handles -- without leaking' '
git stash show --
'
test_expect_success 'controlled error return on unrecognized option' '
test_expect_code 129 git stash show -p --invalid 2>usage &&
grep -e "^usage: git stash show" usage
'
test_done