// it can hold. (<rdar://problem/6806478>)
size_t length = CFStringGetLength(string);
if (length) {
- OwnArrayPtr<UniChar> buffer(new UniChar[length]);
+ OwnArrayPtr<UniChar> buffer = adoptArrayPtr(new UniChar[length]);
CFStringGetCharacters(string, CFRangeMake(0, length), buffer.get());
COMPILE_ASSERT(sizeof(UniChar) == sizeof(UChar), unichar_and_uchar_must_be_same_size);
- return OpaqueJSString::create(reinterpret_cast<UChar*>(buffer.get()), length).releaseRef();
+ return OpaqueJSString::create(reinterpret_cast<UChar*>(buffer.get()), length).leakRef();
} else {
- return OpaqueJSString::create(0, 0).releaseRef();
+ return OpaqueJSString::create(0, 0).leakRef();
}
}