Avoid potential memory leak in String8::set
(Not an actual memory leak because the current clients of String8 never call set more than once for the same object. But you never know who might use String8 in the future.)
This commit is contained in:
parent
324112b60a
commit
7988d5c035
@ -67,6 +67,9 @@ public:
|
||||
}
|
||||
|
||||
void set(const char16_t* o, size_t numChars) {
|
||||
if (mString) {
|
||||
free(mString);
|
||||
}
|
||||
mString = (char*) malloc(numChars + 1);
|
||||
for (size_t i = 0; i < numChars; i++) {
|
||||
mString[i] = (char) o[i];
|
||||
|
Loading…
Reference in New Issue
Block a user