Title: [132988] trunk/Tools
Revision
132988
Author
[email protected]
Date
2012-10-30 23:08:17 -0700 (Tue, 30 Oct 2012)

Log Message

[WTR] Memory leaks in TestWebKitAPI::didReceiveMessageFromInjectedBundle()
https://bugs.webkit.org/show_bug.cgi?id=100770

Patch by Sudarsana Nagineni <[email protected]> on 2012-10-30
Reviewed by Sam Weinig.

Adopt strings returned by WKStringCreateWithUTF8CString() in
didReceiveMessageFromInjectedBundle() to avoid memory leaks.

* TestWebKitAPI/Tests/WebKit2/WillSendSubmitEvent.cpp:
(TestWebKitAPI::didReceiveMessageFromInjectedBundle):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (132987 => 132988)


--- trunk/Tools/ChangeLog	2012-10-31 05:59:42 UTC (rev 132987)
+++ trunk/Tools/ChangeLog	2012-10-31 06:08:17 UTC (rev 132988)
@@ -1,3 +1,16 @@
+2012-10-30  Sudarsana Nagineni  <[email protected]>
+
+        [WTR] Memory leaks in TestWebKitAPI::didReceiveMessageFromInjectedBundle()
+        https://bugs.webkit.org/show_bug.cgi?id=100770
+
+        Reviewed by Sam Weinig.
+
+        Adopt strings returned by WKStringCreateWithUTF8CString() in
+        didReceiveMessageFromInjectedBundle() to avoid memory leaks.
+
+        * TestWebKitAPI/Tests/WebKit2/WillSendSubmitEvent.cpp:
+        (TestWebKitAPI::didReceiveMessageFromInjectedBundle):
+
 2012-10-30  Kangil Han  <[email protected]>
 
         Fix broken python unit test

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2/WillSendSubmitEvent.cpp (132987 => 132988)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/WillSendSubmitEvent.cpp	2012-10-31 05:59:42 UTC (rev 132987)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/WillSendSubmitEvent.cpp	2012-10-31 06:08:17 UTC (rev 132988)
@@ -41,14 +41,17 @@
     EXPECT_EQ(WKDictionaryGetTypeID(), WKGetTypeID(body));
     WKDictionaryRef values = static_cast<WKDictionaryRef>(body);
 
-    WKStringRef textFieldValueWK = static_cast<WKStringRef>(WKDictionaryGetItemForKey(values, WKStringCreateWithUTF8CString("textField")));
+    WKRetainPtr<WKStringRef> textFieldKey(AdoptWK, WKStringCreateWithUTF8CString("textField"));
+    WKStringRef textFieldValueWK = static_cast<WKStringRef>(WKDictionaryGetItemForKey(values, textFieldKey.get()));
     EXPECT_WK_STREQ("text field", textFieldValueWK);
 
-    WKStringRef passwordFieldValueWK = static_cast<WKStringRef>(WKDictionaryGetItemForKey(values, WKStringCreateWithUTF8CString("passwordField")));
+    WKRetainPtr<WKStringRef> passwordFieldKey(AdoptWK, WKStringCreateWithUTF8CString("passwordField"));
+    WKStringRef passwordFieldValueWK = static_cast<WKStringRef>(WKDictionaryGetItemForKey(values, passwordFieldKey.get()));
     EXPECT_WK_STREQ("password field", passwordFieldValueWK);
 
     // <input type="hidden"> fields are not sent.
-    WKStringRef hiddenFieldValueWK = static_cast<WKStringRef>(WKDictionaryGetItemForKey(values, WKStringCreateWithUTF8CString("hiddenField")));
+    WKRetainPtr<WKStringRef> hiddenFieldKey(AdoptWK, WKStringCreateWithUTF8CString("hiddenField"));
+    WKStringRef hiddenFieldValueWK = static_cast<WKStringRef>(WKDictionaryGetItemForKey(values, hiddenFieldKey.get()));
     EXPECT_NULL(hiddenFieldValueWK);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to