Skip to content

Commit a03b3b6

Browse files
committed
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
1 parent 9a24289 commit a03b3b6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/backend/utils/adt/pg_locale.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2810,9 +2810,12 @@ icu_set_collation_attributes(UCollator *collator, const char *loc)
28102810
* message across ICU versions.
28112811
*/
28122812
if (U_FAILURE(status))
2813+
{
2814+
ucol_close(collator);
28132815
ereport(ERROR,
28142816
(errmsg("could not open collator for locale \"%s\": %s",
28152817
loc, u_errorName(status))));
2818+
}
28162819
}
28172820
}
28182821

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy