aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-08-22 11:17:13 +0200
committerJunio C Hamano <gitster@pobox.com>2024-08-22 09:18:03 -0700
commit643c6f576cb7b0a7e2345cd4f8e8d7468fefc483 (patch)
treefe1007ecd39a7ead4c4dd0352f61c9cf6b37803c
parente5530f9c5c011125420bb6416f9ba519082e98b6 (diff)
downloadgit-643c6f576cb7b0a7e2345cd4f8e8d7468fefc483.tar.xz
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>
-rw-r--r--convert.c3
-rwxr-xr-xt/t4150-am.sh1
2 files changed, 4 insertions, 0 deletions
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' '