diff options
| author | Patrick Steinhardt <ps@pks.im> | 2024-08-22 11:17:13 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-08-22 09:18:03 -0700 |
| commit | 643c6f576cb7b0a7e2345cd4f8e8d7468fefc483 (patch) | |
| tree | fe1007ecd39a7ead4c4dd0352f61c9cf6b37803c | |
| parent | e5530f9c5c011125420bb6416f9ba519082e98b6 (diff) | |
| download | git-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.c | 3 | ||||
| -rwxr-xr-x | t/t4150-am.sh | 1 |
2 files changed, 4 insertions, 0 deletions
@@ -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' ' |
