REGRESSION (r15133): Fix leak of JSStringRef in minidom
authorddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 May 2019 01:17:47 +0000 (01:17 +0000)
committerddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 May 2019 01:17:47 +0000 (01:17 +0000)
<https://webkit.org/b/197968>
<rdar://problem/50872430>

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

* API/tests/minidom.c:
(print): Call JSStringRelease() to fix the leak.

Tools:

* TestWebKitAPI/Tests/WebKitObjC/UserContentTest.mm:
(expectScriptValueIsString): Drive-by fix to use adopt() instead
of JSRetainPtr<JSStringRef> string(Adopt, JSValueToStringCopy(...)).

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245430 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/API/tests/minidom.c
Source/JavaScriptCore/ChangeLog
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitObjC/UserContentTest.mm

index 41f18cd..6ebb399 100644 (file)
@@ -91,6 +91,7 @@ static JSValueRef print(JSContextRef context, JSObjectRef object, JSObjectRef th
         char stringUTF8[numChars];
         JSStringGetUTF8CString(string, stringUTF8, numChars);
         printf("%s\n", stringUTF8);
+        JSStringRelease(string);
     }
     
     return JSValueMakeUndefined(context);
index c550636..a2de4b7 100644 (file)
@@ -1,3 +1,14 @@
+2019-05-16  David Kilzer  <ddkilzer@apple.com>
+
+        REGRESSION (r15133): Fix leak of JSStringRef in minidom
+        <https://webkit.org/b/197968>
+        <rdar://problem/50872430>
+
+        Reviewed by Joseph Pecoraro.
+
+        * API/tests/minidom.c:
+        (print): Call JSStringRelease() to fix the leak.
+
 2019-05-16  Ross Kirsling  <ross.kirsling@sony.com>
 
         [JSC] Invalid AssignmentTargetType should be an early error.
index f5ad466..0590e8a 100644 (file)
@@ -1,5 +1,17 @@
 2019-05-16  David Kilzer  <ddkilzer@apple.com>
 
+        REGRESSION (r15133): Fix leak of JSStringRef in minidom
+        <https://webkit.org/b/197968>
+        <rdar://problem/50872430>
+
+        Reviewed by Joseph Pecoraro.
+
+        * TestWebKitAPI/Tests/WebKitObjC/UserContentTest.mm:
+        (expectScriptValueIsString): Drive-by fix to use adopt() instead
+        of JSRetainPtr<JSStringRef> string(Adopt, JSValueToStringCopy(...)).
+
+2019-05-16  David Kilzer  <ddkilzer@apple.com>
+
         REGRESSION (r84160): Leak of OpaqueJSString under WTR::JSTestRunner::pathToLocalResource (32 bytes) in com.apple.WebKit.WebContent running layout tests
         <https://webkit.org/b/197965>
 
index b63d1d6..4fba91f 100644 (file)
@@ -77,7 +77,7 @@ static void expectScriptValueIsString(WKSerializedScriptValueRef serializedScrip
     JSValueRef scriptValue = WKSerializedScriptValueDeserialize(serializedScriptValue, scriptContext, 0);
     EXPECT_TRUE(JSValueIsString(scriptContext, scriptValue));
     
-    JSRetainPtr<JSStringRef> scriptString(Adopt, JSValueToStringCopy(scriptContext, scriptValue, 0));
+    auto scriptString = adopt(JSValueToStringCopy(scriptContext, scriptValue, 0));
     EXPECT_TRUE(JSStringIsEqualToUTF8CString(scriptString.get(), expectedValue));
     
     JSGlobalContextRelease(scriptContext);