Title: [129022] trunk
Revision
129022
Author
commit-qu...@webkit.org
Date
2012-09-19 10:57:29 -0700 (Wed, 19 Sep 2012)

Log Message

[WTR] Memory leaks in TestRunner::deliverWebIntent()
https://bugs.webkit.org/show_bug.cgi?id=97111

Patch by Sudarsana Nagineni <sudarsana.nagin...@intel.com> on 2012-09-19
Reviewed by Kenneth Rohde Christiansen.

Source/WebKit2:

Fix memory leaks in WKBundleIntentCreate() by adopting strings
created with WKStringCreateWithUTF8CString().

* WebProcess/InjectedBundle/API/c/WKBundleIntent.cpp:
(WKBundleIntentCreate):

Tools:

Fix memory leaks in deliverWebIntent() by adopting strings
created with WKStringCreateWithUTF8CString().

* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::deliverWebIntent):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (129021 => 129022)


--- trunk/Source/WebKit2/ChangeLog	2012-09-19 17:56:34 UTC (rev 129021)
+++ trunk/Source/WebKit2/ChangeLog	2012-09-19 17:57:29 UTC (rev 129022)
@@ -1,3 +1,16 @@
+2012-09-19  Sudarsana Nagineni  <sudarsana.nagin...@intel.com>
+
+        [WTR] Memory leaks in TestRunner::deliverWebIntent()
+        https://bugs.webkit.org/show_bug.cgi?id=97111
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Fix memory leaks in WKBundleIntentCreate() by adopting strings
+        created with WKStringCreateWithUTF8CString().
+
+        * WebProcess/InjectedBundle/API/c/WKBundleIntent.cpp:
+        (WKBundleIntentCreate):
+
 2012-09-19  Christophe Dumez  <christophe.du...@intel.com>
 
         [EFL][WK2] fast/forms/select-writing-direction-natural.html is failing

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntent.cpp (129021 => 129022)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntent.cpp	2012-09-19 17:56:34 UTC (rev 129021)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntent.cpp	2012-09-19 17:57:29 UTC (rev 129022)
@@ -33,6 +33,7 @@
 #include "WKAPICast.h"
 #include "WKBundleAPICast.h"
 #include "WKDictionary.h"
+#include "WKRetainPtr.h"
 #include "WKString.h"
 #include "WebSerializedScriptValue.h"
 
@@ -52,11 +53,14 @@
 WKBundleIntentRef WKBundleIntentCreate(WKDictionaryRef dictionaryRef)
 {
 #if ENABLE(WEB_INTENTS)
-    WKStringRef action = "" WKStringCreateWithUTF8CString("action")));
+    WKRetainPtr<WKStringRef> actionKey(AdoptWK, WKStringCreateWithUTF8CString("action"));
+    WKStringRef action = "" actionKey.get()));
     ASSERT(action);
-    WKStringRef type = static_cast<WKStringRef>(WKDictionaryGetItemForKey(dictionaryRef, WKStringCreateWithUTF8CString("type")));
+    WKRetainPtr<WKStringRef> typeKey(AdoptWK, WKStringCreateWithUTF8CString("type"));
+    WKStringRef type = static_cast<WKStringRef>(WKDictionaryGetItemForKey(dictionaryRef, typeKey.get()));
     ASSERT(type);
-    WKSerializedScriptValueRef data = "" WKStringCreateWithUTF8CString("data")));
+    WKRetainPtr<WKStringRef> dataKey(AdoptWK, WKStringCreateWithUTF8CString("data"));
+    WKSerializedScriptValueRef data = "" dataKey.get()));
     MessagePortArray dummyPorts;
     ExceptionCode ec;
 

Modified: trunk/Tools/ChangeLog (129021 => 129022)


--- trunk/Tools/ChangeLog	2012-09-19 17:56:34 UTC (rev 129021)
+++ trunk/Tools/ChangeLog	2012-09-19 17:57:29 UTC (rev 129022)
@@ -1,3 +1,16 @@
+2012-09-19  Sudarsana Nagineni  <sudarsana.nagin...@intel.com>
+
+        [WTR] Memory leaks in TestRunner::deliverWebIntent()
+        https://bugs.webkit.org/show_bug.cgi?id=97111
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Fix memory leaks in deliverWebIntent() by adopting strings
+        created with WKStringCreateWithUTF8CString().
+
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::TestRunner::deliverWebIntent):
+
 2012-09-19  Simon Hausmann  <simon.hausm...@digia.com>
 
         [Qt] Fix incremental builds with all-in-one-files and gccdepends

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (129021 => 129022)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2012-09-19 17:56:34 UTC (rev 129021)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2012-09-19 17:57:29 UTC (rev 129022)
@@ -691,10 +691,15 @@
     WKRetainPtr<WKSerializedScriptValueRef> dataWK(AdoptWK, WKSerializedScriptValueCreate(context, JSValueMakeString(context, data), 0));
 
     WKRetainPtr<WKMutableDictionaryRef> intentInitDict(AdoptWK, WKMutableDictionaryCreate());
-    WKDictionaryAddItem(intentInitDict.get(), WKStringCreateWithUTF8CString("action"), actionWK.get());
-    WKDictionaryAddItem(intentInitDict.get(), WKStringCreateWithUTF8CString("type"), typeWK.get());
-    WKDictionaryAddItem(intentInitDict.get(), WKStringCreateWithUTF8CString("data"), dataWK.get());
+    WKRetainPtr<WKStringRef> actionKey(AdoptWK, WKStringCreateWithUTF8CString("action"));
+    WKDictionaryAddItem(intentInitDict.get(), actionKey.get(), actionWK.get());
 
+    WKRetainPtr<WKStringRef> typeKey(AdoptWK, WKStringCreateWithUTF8CString("type"));
+    WKDictionaryAddItem(intentInitDict.get(), typeKey.get(), typeWK.get());
+
+    WKRetainPtr<WKStringRef> dataKey(AdoptWK, WKStringCreateWithUTF8CString("data"));
+    WKDictionaryAddItem(intentInitDict.get(), dataKey.get(), dataWK.get());
+
     WKRetainPtr<WKBundleIntentRef> wkIntent(AdoptWK, WKBundleIntentCreate(intentInitDict.get()));
     WKBundlePageDeliverIntentToFrame(InjectedBundle::shared().page()->page(), mainFrame, wkIntent.get());
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to