Skip to content

Commit 1d32417

Browse files
committed
lib/icu/Init: call u_init() and u_cleanup()
Make valgrind happy.
1 parent 37b3190 commit 1d32417

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/lib/icu/Init.cxx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,30 @@
1919

2020
#include "config.h"
2121
#include "Init.hxx"
22+
#include "Error.hxx"
2223
#include "Collate.hxx"
24+
#include "util/Error.hxx"
25+
26+
#include <unicode/uclean.h>
2327

2428
bool
2529
IcuInit(Error &error)
2630
{
31+
UErrorCode code = U_ZERO_ERROR;
32+
u_init(&code);
33+
if (U_FAILURE(code)) {
34+
error.Format(icu_domain, int(code),
35+
"u_init() failed: %s", u_errorName(code));
36+
return false;
37+
}
38+
2739
return IcuCollateInit(error);
2840
}
2941

3042
void
3143
IcuFinish()
3244
{
3345
IcuCollateFinish();
46+
47+
u_cleanup();
3448
}

0 commit comments

Comments
 (0)