Title: [92552] trunk/Source
Revision
92552
Author
[email protected]
Date
2011-08-06 09:17:14 -0700 (Sat, 06 Aug 2011)

Log Message

Potential Leaks - RetainPtr<> over retaining Create'd objects
https://bugs.webkit.org/show_bug.cgi?id=65806

Reviewed by Darin Adler.

Fix a possible leak by adopting an allocation instead of retaining it.

Source/WebCore:

* platform/network/mac/NetworkStateNotifierMac.cpp:
(WebCore::NetworkStateNotifier::NetworkStateNotifier):
* plugins/mac/PluginPackageMac.cpp:
(WebCore::stringListFromResourceId):
(WebCore::PluginPackage::fetchInfo):

Source/WebKit/mac:

* WebView/WebView.mm:
(-[WebView previousValidKeyView]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (92551 => 92552)


--- trunk/Source/WebCore/ChangeLog	2011-08-06 15:57:09 UTC (rev 92551)
+++ trunk/Source/WebCore/ChangeLog	2011-08-06 16:17:14 UTC (rev 92552)
@@ -1,3 +1,18 @@
+2011-08-06  Joseph Pecoraro  <[email protected]>
+
+        Potential Leaks - RetainPtr<> over retaining Create'd objects
+        https://bugs.webkit.org/show_bug.cgi?id=65806
+
+        Reviewed by Darin Adler.
+
+        Fix a possible leak by adopting an allocation instead of retaining it.
+
+        * platform/network/mac/NetworkStateNotifierMac.cpp:
+        (WebCore::NetworkStateNotifier::NetworkStateNotifier):
+        * plugins/mac/PluginPackageMac.cpp:
+        (WebCore::stringListFromResourceId):
+        (WebCore::PluginPackage::fetchInfo):
+
 2011-08-06  Rafael Brandao  <[email protected]>
 
         REGRESSION (r91540): Favicons are not loaded

Modified: trunk/Source/WebCore/platform/network/mac/NetworkStateNotifierMac.cpp (92551 => 92552)


--- trunk/Source/WebCore/platform/network/mac/NetworkStateNotifierMac.cpp	2011-08-06 15:57:09 UTC (rev 92551)
+++ trunk/Source/WebCore/platform/network/mac/NetworkStateNotifierMac.cpp	2011-08-06 16:17:14 UTC (rev 92552)
@@ -105,7 +105,7 @@
     if (!m_store)
         return;
 
-    RetainPtr<CFRunLoopSourceRef> configSource = SCDynamicStoreCreateRunLoopSource(0, m_store.get(), 0);
+    RetainPtr<CFRunLoopSourceRef> configSource(AdoptCF, SCDynamicStoreCreateRunLoopSource(0, m_store.get(), 0));
     if (!configSource)
         return;
 

Modified: trunk/Source/WebCore/plugins/mac/PluginPackageMac.cpp (92551 => 92552)


--- trunk/Source/WebCore/plugins/mac/PluginPackageMac.cpp	2011-08-06 15:57:09 UTC (rev 92551)
+++ trunk/Source/WebCore/plugins/mac/PluginPackageMac.cpp	2011-08-06 16:17:14 UTC (rev 92552)
@@ -120,7 +120,7 @@
 
     for (SInt16 i = 0; i < count; ++i) {
         unsigned char length = *p;
-        WTF::RetainPtr<CFStringRef> str = CFStringCreateWithPascalString(0, p, encoding);
+        WTF::RetainPtr<CFStringRef> str(AdoptCF, CFStringCreateWithPascalString(0, p, encoding));
         list.append(str.get());
         p += 1 + length;
     }
@@ -140,7 +140,7 @@
 
         WTF::RetainPtr<CFStringRef> fileName = (CFStringRef)mimeTypesFileName.get();
         WTF::RetainPtr<CFStringRef> homeDir = homeDirectoryPath().createCFString();
-        WTF::RetainPtr<CFStringRef> path = CFStringCreateWithFormat(0, 0, CFSTR("%@/Library/Preferences/%@"), homeDir.get(), fileName.get());
+        WTF::RetainPtr<CFStringRef> path(AdoptCF, CFStringCreateWithFormat(0, 0, CFSTR("%@/Library/Preferences/%@"), homeDir.get(), fileName.get()));
 
         WTF::RetainPtr<CFDictionaryRef> plist = readPListFile(path.get(), /*createFile*/ false, m_module);
         if (plist) {

Modified: trunk/Source/WebKit/mac/ChangeLog (92551 => 92552)


--- trunk/Source/WebKit/mac/ChangeLog	2011-08-06 15:57:09 UTC (rev 92551)
+++ trunk/Source/WebKit/mac/ChangeLog	2011-08-06 16:17:14 UTC (rev 92552)
@@ -1,3 +1,15 @@
+2011-08-06  Joseph Pecoraro  <[email protected]>
+
+        Potential Leaks - RetainPtr<> over retaining Create'd objects
+        https://bugs.webkit.org/show_bug.cgi?id=65806
+
+        Reviewed by Darin Adler.
+
+        Fix a possible leak by adopting an allocation instead of retaining it.
+
+        * WebView/WebView.mm:
+        (-[WebView previousValidKeyView]):
+
 2011-08-05  Anders Carlsson  <[email protected]>
 
         Remove PluginHalter

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (92551 => 92552)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2011-08-06 15:57:09 UTC (rev 92551)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2011-08-06 16:17:14 UTC (rev 92552)
@@ -4212,7 +4212,7 @@
 
     // Use a visited set so we don't loop indefinitely when walking crazy key loops.
     // AppKit uses such sets internally and we want our loop to be as robust as its loops.
-    RetainPtr<CFMutableSetRef> visitedViews = CFSetCreateMutable(0, 0, 0);
+    RetainPtr<CFMutableSetRef> visitedViews(AdoptCF, CFSetCreateMutable(0, 0, 0));
     CFSetAddValue(visitedViews.get(), result);
 
     NSView *previousView = self;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to