Skip to content

Commit 643c6f5

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e5530f9 commit 643c6f5

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

convert.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,6 +1371,9 @@ void reset_parsed_attributes(void)
13711371
for (drv = user_convert; drv; drv = next) {
13721372
next = drv->next;
13731373
free((void *)drv->name);
1374+
free((void *)drv->smudge);
1375+
free((void *)drv->clean);
1376+
free((void *)drv->process);
13741377
free(drv);
13751378
}
13761379
user_convert = NULL;

t/t4150-am.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ test_description='git am running'
55
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
66
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
77

8+
TEST_PASSES_SANITIZE_LEAK=true
89
. ./test-lib.sh
910

1011
test_expect_success 'setup: messages' '

0 commit comments

Comments
 (0)