Merge "Fix memory leak in String16"
This commit is contained in:
commit
9a66161585
|
@ -346,7 +346,6 @@ void* String16::edit() {
|
||||||
if (isStaticString()) {
|
if (isStaticString()) {
|
||||||
buf = static_cast<SharedBuffer*>(alloc((size() + 1) * sizeof(char16_t)));
|
buf = static_cast<SharedBuffer*>(alloc((size() + 1) * sizeof(char16_t)));
|
||||||
if (buf) {
|
if (buf) {
|
||||||
buf->acquire();
|
|
||||||
memcpy(buf->data(), mString, (size() + 1) * sizeof(char16_t));
|
memcpy(buf->data(), mString, (size() + 1) * sizeof(char16_t));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -365,7 +364,6 @@ void* String16::editResize(size_t newSize) {
|
||||||
}
|
}
|
||||||
buf = static_cast<SharedBuffer*>(alloc(newSize));
|
buf = static_cast<SharedBuffer*>(alloc(newSize));
|
||||||
if (buf) {
|
if (buf) {
|
||||||
buf->acquire();
|
|
||||||
memcpy(buf->data(), mString, copySize);
|
memcpy(buf->data(), mString, copySize);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue