-
-
Notifications
You must be signed in to change notification settings - Fork 767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ICU-22819 Fix memory leak during error in mlbe.cpp #3078
ICU-22819 Fix memory leak during error in mlbe.cpp #3078
Conversation
icu4c/source/common/mlbe.cpp
Outdated
if (idx + 4 < codePointLength) { | ||
indexList[idx + 6] = numCodeUnits; | ||
numCodeUnits += U16_LENGTH(inString.char32At(indexList[idx + 6])); | ||
} | ||
} | ||
} | ||
uprv_free(indexList); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could change indexList to be a LocalMemory<int32_t>. Get rid of the error prone naked pointer and explicit free() altogether.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I second that...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PTAL
5cbd66f
to
61fa9cf
Compare
Notice: the branch changed across the force-push!
~ Your Friendly Jira-GitHub PR Checker Bot |
icu4c/source/common/mlbe.cpp
Outdated
if (idx + 4 < codePointLength) { | ||
indexList[idx + 6] = numCodeUnits; | ||
numCodeUnits += U16_LENGTH(inString.char32At(indexList[idx + 6])); | ||
} | ||
} | ||
} | ||
uprv_free(indexList); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I second that...
Checklist