aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-06-11 11:20:28 +0200
committerJunio C Hamano <gitster@pobox.com>2024-06-11 13:15:06 -0700
commit748bd0943b696ba2b2942ce6e9d0dbfebf8b1fc3 (patch)
tree6e9b81475b03466777c5007bc42beb79c1c2030f
parentrevision: free diff options (diff)
downloadgit-748bd0943b696ba2b2942ce6e9d0dbfebf8b1fc3.tar.gz
git-748bd0943b696ba2b2942ce6e9d0dbfebf8b1fc3.zip
builtin/stash: fix leak in `show_stash()`
We leak the `revision_args()` variable. Fix this. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/stash.c2
-rwxr-xr-xt/t3420-rebase-autostash.sh1
-rwxr-xr-xt/t3907-stash-show-config.sh1
3 files changed, 4 insertions, 0 deletions
diff --git a/builtin/stash.c b/builtin/stash.c
index 628d848a0b..1ed0a9a5d9 100644
--- a/builtin/stash.c
+++ b/builtin/stash.c
@@ -975,7 +975,9 @@ static int show_stash(int argc, const char **argv, const char *prefix)
log_tree_diff_flush(&rev);
ret = diff_result_code(&rev.diffopt);
+
cleanup:
+ strvec_clear(&revision_args);
strvec_clear(&stash_args);
free_stash_info(&info);
release_revisions(&rev);
diff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh
index 1a820f1481..63e400b89f 100755
--- a/t/t3420-rebase-autostash.sh
+++ b/t/t3420-rebase-autostash.sh
@@ -7,6 +7,7 @@ test_description='git rebase --autostash tests'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t3907-stash-show-config.sh b/t/t3907-stash-show-config.sh
index 10914bba7b..7a2eb98b86 100755
--- a/t/t3907-stash-show-config.sh
+++ b/t/t3907-stash-show-config.sh
@@ -2,6 +2,7 @@
test_description='Test git stash show configuration.'
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '