Skip to content

Commit

Permalink
Fix memory leak for hashing with nondeterministic collations.
Browse files Browse the repository at this point in the history
Backpatch through 12, where nondeterministic collations were
introduced (5e1963f).

Backpatch-through: 12
  • Loading branch information
jeff-davis committed Dec 1, 2022
1 parent e10799a commit 9377b4f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/backend/access/hash/hashfunc.c
Expand Up @@ -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);

Expand Down Expand Up @@ -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));

Expand Down
2 changes: 2 additions & 0 deletions src/backend/utils/adt/varchar.c
Expand Up @@ -1030,6 +1030,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);

Expand Down Expand Up @@ -1091,6 +1092,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));

Expand Down

0 comments on commit 9377b4f

Please sign in to comment.