WebKitTestRunner leaks strings in generateWhitelist()
authorap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Jun 2015 22:53:49 +0000 (22:53 +0000)
committerap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Jun 2015 22:53:49 +0000 (22:53 +0000)
https://bugs.webkit.org/show_bug.cgi?id=145665

Reviewed by Myles C. Maxfield.

* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::generateWhitelist):

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

Tools/ChangeLog
Tools/WebKitTestRunner/mac/TestControllerMac.mm

index 6f1ee1b321e2abc12f92990b8e0cc5873db3e315..78defc01b0e26f229ae84f6df5ba88b995981a81 100644 (file)
@@ -1,3 +1,13 @@
+2015-06-04  Alexey Proskuryakov  <ap@apple.com>
+
+        WebKitTestRunner leaks strings in generateWhitelist()
+        https://bugs.webkit.org/show_bug.cgi?id=145665
+
+        Reviewed by Myles C. Maxfield.
+
+        * WebKitTestRunner/mac/TestControllerMac.mm:
+        (WTR::generateWhitelist):
+
 2015-06-03  Yusuke Suzuki  <utatane.tea@gmail.com>
 
         Fix options in build-jsc for CMake builds
index 466a8b366e015b6a7e4efa9556ebc46b4dd99412..e5e72c6877d7b1907efb03e7df602621b49a95b5 100644 (file)
@@ -286,10 +286,12 @@ static WKRetainPtr<WKArrayRef> generateWhitelist()
     WKMutableArrayRef result = WKMutableArrayCreate();
     for (NSString *fontFamily in allowedFontFamilySet()) {
         NSArray *fontsForFamily = [[NSFontManager sharedFontManager] availableMembersOfFontFamily:fontFamily];
-        WKArrayAppendItem(result, WKStringCreateWithUTF8CString([fontFamily UTF8String]));
+        WKRetainPtr<WKStringRef> familyInFont = adoptWK(WKStringCreateWithUTF8CString([fontFamily UTF8String]));
+        WKArrayAppendItem(result, familyInFont.get());
         for (NSArray *fontInfo in fontsForFamily) {
             // Font name is the first entry in the array.
-            WKArrayAppendItem(result, WKStringCreateWithUTF8CString([[fontInfo objectAtIndex:0] UTF8String]));
+            WKRetainPtr<WKStringRef> fontName = adoptWK(WKStringCreateWithUTF8CString([[fontInfo objectAtIndex:0] UTF8String]));
+            WKArrayAppendItem(result, fontName.get());
         }
     }