diff options
author | Jeff Davis | 2023-03-24 15:47:51 +0000 |
---|---|---|
committer | Jeff Davis | 2023-03-24 15:48:03 +0000 |
commit | a03b3b6b4a7275a66e38280f49fddb9aec8dff3d (patch) | |
tree | 8f3b1fe81596b7426f8ba8f85f8def59ba839e34 | |
parent | 9a242899158c776377696d445df74db270150385 (diff) |
Avoid potential UCollator leak for older ICU versions.
ICU versions 53 and earlier rely on icu_set_collation_attributes() to
process the attributes in the locale string. Avoid leaking the
already-opened UCollator object if an error is encountered.
Discussion: https://postgr.es/m/04182066-7655-344a-b8b7-040b1b2490fb%40enterprisedb.com
Reviewed-by: Peter Eisentraut
-rw-r--r-- | src/backend/utils/adt/pg_locale.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c index 41b0e9fe69..386768ee76 100644 --- a/src/backend/utils/adt/pg_locale.c +++ b/src/backend/utils/adt/pg_locale.c @@ -2810,9 +2810,12 @@ icu_set_collation_attributes(UCollator *collator, const char *loc) * message across ICU versions. */ if (U_FAILURE(status)) + { + ucol_close(collator); ereport(ERROR, (errmsg("could not open collator for locale \"%s\": %s", loc, u_errorName(status)))); + } } } |