aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/formatting.c
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2019-09-03 12:31:03 +0900
committerMichael Paquier <michael@paquier.xyz>2019-09-03 12:31:03 +0900
commit5380719f931a101a6e83efc7a1664e42bd6bf6c3 (patch)
tree2ff4387a216911ac109b7e37e1a005ea0d9f4624 /src/backend/utils/adt/formatting.c
parentaad0926ebbe96fbbc3c963b58f2abbcf81895a06 (diff)
downloadpostgresql-5380719f931a101a6e83efc7a1664e42bd6bf6c3.tar.gz
postgresql-5380719f931a101a6e83efc7a1664e42bd6bf6c3.zip
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
Diffstat (limited to 'src/backend/utils/adt/formatting.c')
-rw-r--r--src/backend/utils/adt/formatting.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c
index 206576d4bd3..caea7bc805e 100644
--- a/src/backend/utils/adt/formatting.c
+++ b/src/backend/utils/adt/formatting.c
@@ -1586,6 +1586,7 @@ str_tolower(const char *buff, size_t nbytes, Oid collid)
&buff_conv, buff_uchar, len_uchar);
icu_from_uchar(&result, buff_conv, len_conv);
pfree(buff_uchar);
+ pfree(buff_conv);
}
else
#endif
@@ -1709,6 +1710,7 @@ str_toupper(const char *buff, size_t nbytes, Oid collid)
&buff_conv, buff_uchar, len_uchar);
icu_from_uchar(&result, buff_conv, len_conv);
pfree(buff_uchar);
+ pfree(buff_conv);
}
else
#endif
@@ -1833,6 +1835,7 @@ str_initcap(const char *buff, size_t nbytes, Oid collid)
&buff_conv, buff_uchar, len_uchar);
icu_from_uchar(&result, buff_conv, len_conv);
pfree(buff_uchar);
+ pfree(buff_conv);
}
else
#endif