]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - API/JSStringRefCF.cpp
JavaScriptCore-903.tar.gz
[apple/javascriptcore.git] / API / JSStringRefCF.cpp
index d1f6fe33032a11a25284da3351cbdb292dfbd169..0877a13e60b2786680b6d9cd8537c591e0b2ef58 100644 (file)
@@ -42,12 +42,12 @@ JSStringRef JSStringCreateWithCFString(CFStringRef string)
     // 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();
     }
 }