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,
800
800
f -> line = e -> line ? xmemdupz (e -> line , e -> len ) : NULL ;
801
801
}
802
802
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
+
803
811
struct moved_entry {
804
812
const struct emitted_diff_symbol * es ;
805
813
struct moved_entry * next_line ;
@@ -2150,7 +2158,6 @@ static void diff_words_flush(struct emit_callback *ecbdata)
2150
2158
2151
2159
for (i = 0 ; i < wol -> nr ; i ++ )
2152
2160
free ((void * )wol -> buf [i ].line );
2153
- free (wol -> buf );
2154
2161
2155
2162
wol -> nr = 0 ;
2156
2163
}
@@ -2228,7 +2235,7 @@ static void free_diff_words_data(struct emit_callback *ecbdata)
2228
2235
{
2229
2236
if (ecbdata -> diff_words ) {
2230
2237
diff_words_flush (ecbdata );
2231
- free (ecbdata -> diff_words -> opt -> emitted_symbols );
2238
+ free_emitted_diff_symbols (ecbdata -> diff_words -> opt -> emitted_symbols );
2232
2239
free (ecbdata -> diff_words -> opt );
2233
2240
free (ecbdata -> diff_words -> minus .text .ptr );
2234
2241
free (ecbdata -> diff_words -> minus .orig );
Original file line number Diff line number Diff line change 6
6
test_description=' Test special whitespace in diff engine.
7
7
8
8
'
9
+
10
+ TEST_PASSES_SANITIZE_LEAK=true
9
11
. ./test-lib.sh
10
12
. " $TEST_DIRECTORY " /lib-diff.sh
11
13
@@ -1622,7 +1624,7 @@ test_expect_success 'cmd option assumes configured colored-moved' '
1622
1624
test_cmp expected actual
1623
1625
'
1624
1626
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' '
1626
1628
cat <<-\EOF >text.txt &&
1627
1629
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
1628
1630
EOF
@@ -1636,6 +1638,12 @@ test_expect_success 'no effect from --color-moved with --word-diff' '
1636
1638
test_cmp expect actual
1637
1639
'
1638
1640
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
+
1639
1647
test_expect_success ' set up whitespace tests' '
1640
1648
git reset --hard &&
1641
1649
# Note that these lines have no leading or trailing whitespace.
@@ -2016,7 +2024,7 @@ test_expect_success '--color-moved rewinds for MIN_ALNUM_COUNT' '
2016
2024
test_cmp expected actual
2017
2025
'
2018
2026
2019
- test_expect_success ' move detection with submodules' '
2027
+ test_expect_success ! SANITIZE_LEAK ' move detection with submodules' '
2020
2028
test_create_repo bananas &&
2021
2029
echo ripe >bananas/recipe &&
2022
2030
git -C bananas add recipe &&
You can’t perform that action at this time.
0 commit comments