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

Commit 3a54eb1

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 f63a5ea commit 3a54eb1

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
@@ -1584,6 +1584,7 @@ str_tolower(const char *buff, size_t nbytes, Oid collid)
15841584
&buff_conv, buff_uchar, len_uchar);
15851585
icu_from_uchar(&result, buff_conv, len_conv);
15861586
pfree(buff_uchar);
1587+
pfree(buff_conv);
15871588
}
15881589
else
15891590
#endif
@@ -1707,6 +1708,7 @@ str_toupper(const char *buff, size_t nbytes, Oid collid)
17071708
&buff_conv, buff_uchar, len_uchar);
17081709
icu_from_uchar(&result, buff_conv, len_conv);
17091710
pfree(buff_uchar);
1711+
pfree(buff_conv);
17101712
}
17111713
else
17121714
#endif
@@ -1831,6 +1833,7 @@ str_initcap(const char *buff, size_t nbytes, Oid collid)
18311833
&buff_conv, buff_uchar, len_uchar);
18321834
icu_from_uchar(&result, buff_conv, len_conv);
18331835
pfree(buff_uchar);
1836+
pfree(buff_conv);
18341837
}
18351838
else
18361839
#endif

0 commit comments

Comments
 (0)