Skip to content

Commit

Permalink
ICU-22581 Fix RBBI leakage
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankYFTang committed Dec 7, 2023
1 parent 2a3cb99 commit 38b88ab
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions icu4c/source/common/rbbiscan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ UBool RBBIRuleScanner::doParseActions(int32_t action)

// Terminate expression, leaves expression parse tree rooted in TOS node.
fixOpStack(RBBINode::precStart);
if (U_FAILURE(*fRB->fStatus)) {
break;
}

RBBINode *startExprNode = fNodeStack[fNodeStackPtr-2];
RBBINode *varRefNode = fNodeStack[fNodeStackPtr-1];
Expand All @@ -312,6 +315,7 @@ UBool RBBIRuleScanner::doParseActions(int32_t action)
UErrorCode t = *fRB->fStatus;
*fRB->fStatus = U_ZERO_ERROR;
error(t);
delete varRefNode;
}

// Clean up the stack.
Expand Down

0 comments on commit 38b88ab

Please sign in to comment.