postgres.git / summary / log / commit / refs

commit    f98c4fb1dd8d117b719963677f0be002cbc5129b
Author:   Jeff Davis <jdavis@postgresql.org>
Date:     Thu Dec 01 19:26:32 2022 +0000
First released in: 16.0, 12.14, 13.10, 14.7, 15.2

    Fix memory leak for hashing with nondeterministic collations.
    
    Backpatch through 12, where nondeterministic collations were
    introduced (5e1963fb76).
    
    Backpatch-through: 12


src/backend/access/hash/hashfunc.c | 2 ++ src/backend/utils/adt/varchar.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/backend/access/hash/hashfunc.c b/src/backend/access/hash/hashfunc.c index a43edfe0cc8..5a9ee7d1099 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 416c73f7286..1540d36c4ca 100644 --- a/src/backend/utils/adt/varchar.c +++ b/src/backend/utils/adt/varchar.c @@ -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)); [parent: af6a76931634]