Fix memory leak for hashing with nondeterministic collations.

Backpatch through 12, where nondeterministic collations were
introduced (5e1963fb76).

Backpatch-through: 12
This commit is contained in:
Jeff Davis 2022-12-01 11:26:32 -08:00
parent a109a0bb50
commit edf12e7bbd
2 changed files with 4 additions and 0 deletions

View File

@ -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));

View File

@ -1031,6 +1031,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);
@ -1092,6 +1093,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));