diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2022-11-08 17:10:34 +0300 |
---|---|---|
committer | Taylor Blau <me@ttaylorr.com> | 2022-11-08 22:55:30 +0300 |
commit | 435285bd82a9356b8e13f83cee77a2db4a0e7f0e (patch) | |
tree | e703ead4c588032143272fd48b40ed9db57d207c /t/t7422-submodule-output.sh | |
parent | 44874cbd19afb6ee6fa7dad01dbe6eec161cc94b (diff) |
submodule--helper: fix a memory leak in "status"
The "status" sub-command was leaking the "struct strvec" it was
setting up for the reasons explained in f92dbdbc6a8 (revisions API:
don't leak memory on argv elements that need free()-ing, 2022-08-02),
so let's use the "free_removed_argv_elements" option to
setup_revisions() to fix the leak.
Even if we did that, clobbering the "diff_files_args.nr" with the
return value of setup_revisions() would leave leaks in place, but we
can just stop clobbering it.
Ever since that code was added in a9f8a37584a (submodule: port
submodule subcommand 'status' from shell to C, 2017-10-06) we've had
no reason to modify the "nr" member ("argc" at the time): The next use
of "diff_files_args" after this is the "strvec_clear()" at the end of
the function.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Diffstat (limited to 't/t7422-submodule-output.sh')
-rwxr-xr-x | t/t7422-submodule-output.sh | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/t/t7422-submodule-output.sh b/t/t7422-submodule-output.sh index 1e9cdf1a68..ab946ec940 100755 --- a/t/t7422-submodule-output.sh +++ b/t/t7422-submodule-output.sh @@ -2,6 +2,7 @@ test_description='submodule --cached, --quiet etc. output' +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh . "$TEST_DIRECTORY"/lib-t3100.sh |