]> 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:49:43 +0000 (11:49 -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 a43edfe0cc8339a9c531f0e206c6c77ee8cb8c1c..5a9ee7d10994f3215f09eb185fa393d7e5d4e4ba 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 416c73f7286ecac656cebf5536013a973d113523..1540d36c4cabf0a5801086b1fe0597aa0ea120ec 100644 (file)
@@ -1021,6 +1021,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);
 
@@ -1082,6 +1083,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));