File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -800,6 +800,14 @@ static void append_emitted_diff_symbol(struct diff_options *o,
800800 f -> line = e -> line ? xmemdupz (e -> line , e -> len ) : NULL ;
801801}
802802
803+ static void free_emitted_diff_symbols (struct emitted_diff_symbols * e )
804+ {
805+ if (!e )
806+ return ;
807+ free (e -> buf );
808+ free (e );
809+ }
810+
803811struct moved_entry {
804812 const struct emitted_diff_symbol * es ;
805813 struct moved_entry * next_line ;
@@ -2150,7 +2158,6 @@ static void diff_words_flush(struct emit_callback *ecbdata)
21502158
21512159 for (i = 0 ; i < wol -> nr ; i ++ )
21522160 free ((void * )wol -> buf [i ].line );
2153- free (wol -> buf );
21542161
21552162 wol -> nr = 0 ;
21562163 }
@@ -2228,7 +2235,7 @@ static void free_diff_words_data(struct emit_callback *ecbdata)
22282235{
22292236 if (ecbdata -> diff_words ) {
22302237 diff_words_flush (ecbdata );
2231- free (ecbdata -> diff_words -> opt -> emitted_symbols );
2238+ free_emitted_diff_symbols (ecbdata -> diff_words -> opt -> emitted_symbols );
22322239 free (ecbdata -> diff_words -> opt );
22332240 free (ecbdata -> diff_words -> minus .text .ptr );
22342241 free (ecbdata -> diff_words -> minus .orig );
Original file line number Diff line number Diff line change 66test_description=' Test special whitespace in diff engine.
77
88'
9+
10+ TEST_PASSES_SANITIZE_LEAK=true
911. ./test-lib.sh
1012. " $TEST_DIRECTORY " /lib-diff.sh
1113
@@ -1622,7 +1624,7 @@ test_expect_success 'cmd option assumes configured colored-moved' '
16221624 test_cmp expected actual
16231625'
16241626
1625- test_expect_success ' no effect from --color-moved with --word-diff' '
1627+ test_expect_success ' no effect on diff from --color-moved with --word-diff' '
16261628 cat <<-\EOF >text.txt &&
16271629 Lorem Ipsum is simply dummy text of the printing and typesetting industry.
16281630 EOF
@@ -1636,6 +1638,12 @@ test_expect_success 'no effect from --color-moved with --word-diff' '
16361638 test_cmp expect actual
16371639'
16381640
1641+ test_expect_success ! SANITIZE_LEAK ' no effect on show from --color-moved with --word-diff' '
1642+ git show --color-moved --word-diff >actual &&
1643+ git show --word-diff >expect &&
1644+ test_cmp expect actual
1645+ '
1646+
16391647test_expect_success ' set up whitespace tests' '
16401648 git reset --hard &&
16411649 # Note that these lines have no leading or trailing whitespace.
@@ -2016,7 +2024,7 @@ test_expect_success '--color-moved rewinds for MIN_ALNUM_COUNT' '
20162024 test_cmp expected actual
20172025'
20182026
2019- test_expect_success ' move detection with submodules' '
2027+ test_expect_success ! SANITIZE_LEAK ' move detection with submodules' '
20202028 test_create_repo bananas &&
20212029 echo ripe >bananas/recipe &&
20222030 git -C bananas add recipe &&
You can’t perform that action at this time.
0 commit comments