Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
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

+3
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)