diff options
author | Jeff Davis <jdavis@postgresql.org> | 2022-12-01 11:26:32 -0800 |
---|---|---|
committer | Jeff Davis <jdavis@postgresql.org> | 2022-12-01 11:52:06 -0800 |
commit | a844052b5d97c351ba800e51e37b833f93863c29 (patch) | |
tree | ef0ab1d492c602112e1a90051b7ce6a943c125a2 | |
parent | a475157e6bf0c0f509cc9fb6ccff2b3876eb5f4b (diff) | |
download | postgresql-a844052b5d97c351ba800e51e37b833f93863c29.tar.gz postgresql-a844052b5d97c351ba800e51e37b833f93863c29.zip |
Fix memory leak for hashing with nondeterministic collations.
Backpatch through 12, where nondeterministic collations were
introduced (5e1963fb76).
Backpatch-through: 12
-rw-r--r-- | src/backend/access/hash/hashfunc.c | 2 | ||||
-rw-r--r-- | src/backend/utils/adt/varchar.c | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/src/backend/access/hash/hashfunc.c b/src/backend/access/hash/hashfunc.c index 06141d853fa..961d069c381 100644 --- a/src/backend/access/hash/hashfunc.c +++ b/src/backend/access/hash/hashfunc.c @@ -303,6 +303,7 @@ hashtext(PG_FUNCTION_ARGS) buf = palloc(bsize); ucol_getSortKey(mylocale->info.icu.ucol, uchar, ulen, buf, bsize); + pfree(uchar); result = hash_any(buf, bsize); @@ -360,6 +361,7 @@ hashtextextended(PG_FUNCTION_ARGS) buf = palloc(bsize); ucol_getSortKey(mylocale->info.icu.ucol, uchar, ulen, buf, bsize); + pfree(uchar); result = hash_any_extended(buf, bsize, PG_GETARG_INT64(1)); diff --git a/src/backend/utils/adt/varchar.c b/src/backend/utils/adt/varchar.c index b595ab9569c..7144622df8a 100644 --- a/src/backend/utils/adt/varchar.c +++ b/src/backend/utils/adt/varchar.c @@ -1020,6 +1020,7 @@ hashbpchar(PG_FUNCTION_ARGS) buf = palloc(bsize); ucol_getSortKey(mylocale->info.icu.ucol, uchar, ulen, buf, bsize); + pfree(uchar); result = hash_any(buf, bsize); @@ -1081,6 +1082,7 @@ hashbpcharextended(PG_FUNCTION_ARGS) buf = palloc(bsize); ucol_getSortKey(mylocale->info.icu.ucol, uchar, ulen, buf, bsize); + pfree(uchar); result = hash_any_extended(buf, bsize, PG_GETARG_INT64(1)); |