From 38b88ab6bd212a1e312142f63387a94be6bdb729 Mon Sep 17 00:00:00 2001 From: Frank Tang Date: Thu, 7 Dec 2023 15:07:27 -0800 Subject: [PATCH] ICU-22581 Fix RBBI leakage --- icu4c/source/common/rbbiscan.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/icu4c/source/common/rbbiscan.cpp b/icu4c/source/common/rbbiscan.cpp index 844b0639099c..ccd2561220dc 100644 --- a/icu4c/source/common/rbbiscan.cpp +++ b/icu4c/source/common/rbbiscan.cpp @@ -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]; @@ -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.