]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Fix memory leak for hashing with nondeterministic collations.
authorJeff Davis <jdavis@postgresql.org>
Thu, 1 Dec 2022 19:26:32 +0000 (11:26 -0800)
committerJeff Davis <jdavis@postgresql.org>
Thu, 1 Dec 2022 19:55:59 +0000 (11:55 -0800)
Backpatch through 12, where nondeterministic collations were
introduced (5e1963fb76).

Backpatch-through: 12

src/backend/access/hash/hashfunc.c
src/backend/utils/adt/varchar.c

index b57ed946c42bb54ede800e95045aa937a8dbad85..f890f79ee180a8dd931d3974a0e99d611db80271 100644 (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));
 
index bbeb0a2653a89dccc916268f12c6c2e81585a273..63a2073a4294215d39bfbc0e97c53481fb4cedb8 100644 (file)
@@ -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);
 
@@ -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));