tests: fix a memory leak in test-parse-options.c
Fix a memory leak in t/helper/test-parse-options.c, we were not freeing the allocated "struct string_list" or its items. Let's move the declaration of the "list" variable into the cmd__parse_options() and release it at the end. Inc8ba163916
(parse-options: add OPT_STRING_LIST helper, 2011-06-09) the "list" variable was added, and later on inc8ba163916
(parse-options: add OPT_STRING_LIST helper, 2011-06-09) the "expect" was added. The "list" variable was last touched in2721ce21e4
(use string_list initializer consistently, 2016-06-13), but it was still left at the static scope, it's better to move it to the function for consistency. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
6a75658c0a
commit
c0b80e05f7
@ -5,6 +5,7 @@
|
||||
|
||||
test_description='our own option parser'
|
||||
|
||||
TEST_PASSES_SANITIZE_LEAK=true
|
||||
. ./test-lib.sh
|
||||
|
||||
cat >expect <<\EOF
|
||||
|
Reference in New Issue
Block a user