Fix potential memory leak in String8::set
Not an actual leak at the moment, since no clients call set more than once, but you never know how a class might be used in the future. Change-Id: I601bad02eb16d522af3216ef903a190741444e4c
This commit is contained in:
@@ -64,6 +64,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];
|
||||
|
||||
Reference in New Issue
Block a user