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 inf92dbdbc6a
(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 ina9f8a37584
(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>
This commit is contained in:

committed by
Taylor Blau

parent
44874cbd19
commit
435285bd82
@ -2,6 +2,7 @@
|
||||
|
||||
test_description='submodule --cached, --quiet etc. output'
|
||||
|
||||
TEST_PASSES_SANITIZE_LEAK=true
|
||||
. ./test-lib.sh
|
||||
. "$TEST_DIRECTORY"/lib-t3100.sh
|
||||
|
||||
|
Reference in New Issue
Block a user