Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5380719

Browse files
committed
Fix memory leak with lower, upper and initcap with ICU-provided collations
The leak happens in str_tolower, str_toupper and str_initcap, which are used in several places including their equivalent SQL-level functions, and can only be triggered when using an ICU-provided collation when converting the input string. b615920 fixed a similar leak. Backpatch down 10 where ICU collations have been introduced. Author: Konstantin Knizhnik Discussion: https://postgr.es/m/94c0ad0a-cbc2-e4a3-7829-2bdeaf9146db@postgrespro.ru Backpatch-through: 10
1 parent aad0926 commit 5380719

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/backend/utils/adt/formatting.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1586,6 +1586,7 @@ str_tolower(const char *buff, size_t nbytes, Oid collid)
15861586
&buff_conv, buff_uchar, len_uchar);
15871587
icu_from_uchar(&result, buff_conv, len_conv);
15881588
pfree(buff_uchar);
1589+
pfree(buff_conv);
15891590
}
15901591
else
15911592
#endif
@@ -1709,6 +1710,7 @@ str_toupper(const char *buff, size_t nbytes, Oid collid)
17091710
&buff_conv, buff_uchar, len_uchar);
17101711
icu_from_uchar(&result, buff_conv, len_conv);
17111712
pfree(buff_uchar);
1713+
pfree(buff_conv);
17121714
}
17131715
else
17141716
#endif
@@ -1833,6 +1835,7 @@ str_initcap(const char *buff, size_t nbytes, Oid collid)
18331835
&buff_conv, buff_uchar, len_uchar);
18341836
icu_from_uchar(&result, buff_conv, len_conv);
18351837
pfree(buff_uchar);
1838+
pfree(buff_conv);
18361839
}
18371840
else
18381841
#endif

0 commit comments

Comments
 (0)