From: Patrick Steinhardt Date: Thu, 22 Aug 2024 09:17:13 +0000 (+0200) Subject: convert: fix leaks when resetting attributes X-Git-Tag: v2.47.0-rc0~79^2~18 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=643c6f576cb7b0a7e2345cd4f8e8d7468fefc483;p=thirdparty%2Fgit.git 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 Signed-off-by: Junio C Hamano --- diff --git a/convert.c b/convert.c index e6184d21f2..c9a31eb4f0 100644 --- a/convert.c +++ b/convert.c @@ -1371,6 +1371,9 @@ void reset_parsed_attributes(void) for (drv = user_convert; drv; drv = next) { next = drv->next; free((void *)drv->name); + free((void *)drv->smudge); + free((void *)drv->clean); + free((void *)drv->process); free(drv); } user_convert = NULL; diff --git a/t/t4150-am.sh b/t/t4150-am.sh index 5e2b6c80ea..232e1394e8 100755 --- a/t/t4150-am.sh +++ b/t/t4150-am.sh @@ -5,6 +5,7 @@ test_description='git am running' GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh test_expect_success 'setup: messages' '