mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-10 15:42:14 +00:00
ICU-22818 Fix memory leak during error in messageformat2_data_model.cpp
See #3077
This commit is contained in:
parent
a22dc93e3a
commit
1eb0ed2fad
1 changed files with 3 additions and 3 deletions
|
@ -1091,13 +1091,13 @@ MFDataModel::MFDataModel(const MFDataModel::Builder& builder, UErrorCode& errorC
|
|||
U_ASSERT(builder.selectors != nullptr);
|
||||
int32_t numVariants = builder.variants->size();
|
||||
int32_t numSelectors = builder.selectors->size();
|
||||
Variant* variants = copyVectorToArray<Variant>(*builder.variants, errorCode);
|
||||
Expression* selectors = copyVectorToArray<Expression>(*builder.selectors, errorCode);
|
||||
LocalArray<Variant> variants(copyVectorToArray<Variant>(*builder.variants, errorCode), errorCode);
|
||||
LocalArray<Expression> selectors(copyVectorToArray<Expression>(*builder.selectors, errorCode), errorCode);
|
||||
if (U_FAILURE(errorCode)) {
|
||||
bogus = true;
|
||||
return;
|
||||
}
|
||||
body.emplace<Matcher>(Matcher(selectors, numSelectors, variants, numVariants));
|
||||
body.emplace<Matcher>(Matcher(selectors.orphan(), numSelectors, variants.orphan(), numVariants));
|
||||
}
|
||||
|
||||
U_ASSERT(builder.bindings != nullptr);
|
||||
|
|
Loading…
Add table
Reference in a new issue