Skip to content

Commit

Permalink
ICU-22796 Bugfix: Memory access after uprv_free().
Browse files Browse the repository at this point in the history
  • Loading branch information
David Yeung authored and roubert committed Jun 14, 2024
1 parent 697cb14 commit 032ec67
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions icu4c/source/common/locid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2665,11 +2665,11 @@ Locale::setKeywordValue(const char* keywordName, const char* keywordValue, UErro
}
uprv_strcpy(newFullName, fullName);
if (fullName != fullNameBuffer) {
// if full Name is already on the heap, need to free it.
uprv_free(fullName);
if (baseName == fullName) {
baseName = newFullName; // baseName should not point to freed memory.
}
// if full Name is already on the heap, need to free it.
uprv_free(fullName);
}
fullName = newFullName;
status = U_ZERO_ERROR;
Expand Down

0 comments on commit 032ec67

Please sign in to comment.