mirror of
https://github.com/git/git.git
synced 2024-11-27 03:53:55 +08:00
convert: fix leaks when resetting attributes
When resetting parsed gitattributes, we free the list of convert drivers parsed from the config. We only free some of the drivers' fields though and thus have memory leaks. Fix this by freeing all allocated convert driver fields to plug these memory leaks. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
e5530f9c5c
commit
643c6f576c
@ -1371,6 +1371,9 @@ void reset_parsed_attributes(void)
|
|||||||
for (drv = user_convert; drv; drv = next) {
|
for (drv = user_convert; drv; drv = next) {
|
||||||
next = drv->next;
|
next = drv->next;
|
||||||
free((void *)drv->name);
|
free((void *)drv->name);
|
||||||
|
free((void *)drv->smudge);
|
||||||
|
free((void *)drv->clean);
|
||||||
|
free((void *)drv->process);
|
||||||
free(drv);
|
free(drv);
|
||||||
}
|
}
|
||||||
user_convert = NULL;
|
user_convert = NULL;
|
||||||
|
@ -5,6 +5,7 @@ test_description='git am running'
|
|||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success 'setup: messages' '
|
test_expect_success 'setup: messages' '
|
||||||
|
Loading…
Reference in New Issue
Block a user