diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2021-10-22 10:55:41 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-10-23 10:45:25 -0700 |
commit | b202e51b15401207667261f2cb384e6faa6ed5c3 (patch) | |
tree | 825782fe21b095928496420000043ae2554be8ac /perl/Git/LoadCPAN.pm | |
parent | grep: use object_array_clear() in cmd_grep() (diff) | |
download | tgif-b202e51b15401207667261f2cb384e6faa6ed5c3.tar.xz |
grep: fix a "path_list" memory leak
Free the "path_list" used in builtin/grep.c, it was declared as
STRING_LIST_INIT_NODUP, let's change it to a STRING_LIST_INIT_DUP
since an early user in cmd_grep() appends a string passed via
parse-options.c to it, which needs to be duplicated.
Let's then convert the remaining callers to use
string_list_append_nodup() instead, allowing us to free the list.
This makes all the tests in t7811-grep-open.sh pass, 6/10 would fail
before this change. The only remaining failure would have been due to
a stray "git checkout" (which still leaks memory). In this case we can
use a "git reset --hard" instead, so let's do that, and move the
test_when_finished() above the code that would modify the relevant
file.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'perl/Git/LoadCPAN.pm')
0 files changed, 0 insertions, 0 deletions