diff options
| author | Patrick Steinhardt <ps@pks.im> | 2024-06-11 11:21:25 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-06-11 13:15:08 -0700 |
| commit | 3332f35577ccbb51a50d88d16caafcceaab23767 (patch) | |
| tree | fc04475a6d497eebc65cfb9a78b7a625892875be /t | |
| parent | ee6a998583108cebc0db28d70df2aa1b547b6251 (diff) | |
| download | git-3332f35577ccbb51a50d88d16caafcceaab23767.tar.xz | |
builtin/blame: fix leaking prefixed paths
In `cmd_blame()` we compute prefixed paths by calling `add_prefix()`,
which itself calls `prefix_path()`. While `prefix_path()` returns an
allocated string, `add_prefix()` pretends to return a constant string.
Consequently, this path never gets freed.
Fix the return type to be `char *` and free the path to plug the memory
leak.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
| -rwxr-xr-x | t/t6130-pathspec-noglob.sh | 2 | ||||
| -rwxr-xr-x | t/t7010-setup.sh | 1 | ||||
| -rwxr-xr-x | t/t8003-blame-corner-cases.sh | 1 | ||||
| -rwxr-xr-x | t/t8008-blame-formats.sh | 2 |
4 files changed, 6 insertions, 0 deletions
diff --git a/t/t6130-pathspec-noglob.sh b/t/t6130-pathspec-noglob.sh index ba7902c9cd..82de25d549 100755 --- a/t/t6130-pathspec-noglob.sh +++ b/t/t6130-pathspec-noglob.sh @@ -1,6 +1,8 @@ #!/bin/sh test_description='test globbing (and noglob) of pathspec limiting' + +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh test_expect_success 'create commits with glob characters' ' diff --git a/t/t7010-setup.sh b/t/t7010-setup.sh index 520f96d09f..d9add2162e 100755 --- a/t/t7010-setup.sh +++ b/t/t7010-setup.sh @@ -2,6 +2,7 @@ test_description='setup taking and sanitizing funny paths' +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh test_expect_success setup ' diff --git a/t/t8003-blame-corner-cases.sh b/t/t8003-blame-corner-cases.sh index 731265541a..6288352f57 100755 --- a/t/t8003-blame-corner-cases.sh +++ b/t/t8003-blame-corner-cases.sh @@ -4,6 +4,7 @@ test_description='git blame corner cases' GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh pick_fc='s/^[0-9a-f^]* *\([^ ]*\) *(\([^ ]*\) .*/\1-\2/' diff --git a/t/t8008-blame-formats.sh b/t/t8008-blame-formats.sh index ae4b579d24..fb5d225a67 100755 --- a/t/t8008-blame-formats.sh +++ b/t/t8008-blame-formats.sh @@ -1,6 +1,8 @@ #!/bin/sh test_description='blame output in various formats on a simple case' + +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh test_expect_success 'setup' ' |
