Title: [149375] trunk/Source/WebCore
Revision
149375
Author
[email protected]
Date
2013-04-30 10:05:11 -0700 (Tue, 30 Apr 2013)

Log Message

[CG] Over-release in MIME type registry code
https://bugs.webkit.org/show_bug.cgi?id=115423

Reviewed by Eric Carlson.

Sam Weinig spotted these by code inspection. I don't know how to make a test demonstrating
the problem, but this is clearly an over-release.

* platform/MIMETypeRegistry.cpp:
(WebCore::initializeSupportedImageMIMETypes): Removed incorrect adoptCF call on a string we
are getting from a CFArray.
(WebCore::initializeSupportedImageMIMETypesForEncoding): Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (149374 => 149375)


--- trunk/Source/WebCore/ChangeLog	2013-04-30 16:57:24 UTC (rev 149374)
+++ trunk/Source/WebCore/ChangeLog	2013-04-30 17:05:11 UTC (rev 149375)
@@ -1,3 +1,18 @@
+2013-04-30  Darin Adler  <[email protected]>
+
+        [CG] Over-release in MIME type registry code
+        https://bugs.webkit.org/show_bug.cgi?id=115423
+
+        Reviewed by Eric Carlson.
+
+        Sam Weinig spotted these by code inspection. I don't know how to make a test demonstrating
+        the problem, but this is clearly an over-release.
+
+        * platform/MIMETypeRegistry.cpp:
+        (WebCore::initializeSupportedImageMIMETypes): Removed incorrect adoptCF call on a string we
+        are getting from a CFArray.
+        (WebCore::initializeSupportedImageMIMETypesForEncoding): Ditto.
+
 2013-04-30  Mike Lattanzio  <[email protected]>
 
         [BlackBerry] ImageBuffer::copyImage leaking memory

Modified: trunk/Source/WebCore/platform/MIMETypeRegistry.cpp (149374 => 149375)


--- trunk/Source/WebCore/platform/MIMETypeRegistry.cpp	2013-04-30 16:57:24 UTC (rev 149374)
+++ trunk/Source/WebCore/platform/MIMETypeRegistry.cpp	2013-04-30 17:05:11 UTC (rev 149375)
@@ -39,6 +39,7 @@
 #include <ApplicationServices/ApplicationServices.h>
 #include <wtf/RetainPtr.h>
 #endif
+
 #if PLATFORM(QT)
 #include <QImageReader>
 #include <QImageWriter>
@@ -197,8 +198,8 @@
     RetainPtr<CFArrayRef> supportedTypes = adoptCF(CGImageSourceCopyTypeIdentifiers());
     CFIndex count = CFArrayGetCount(supportedTypes.get());
     for (CFIndex i = 0; i < count; i++) {
-        RetainPtr<CFStringRef> supportedType = adoptCF(reinterpret_cast<CFStringRef>(CFArrayGetValueAtIndex(supportedTypes.get(), i)));
-        String mimeType = MIMETypeForImageSourceType(supportedType.get());
+        CFStringRef supportedType = reinterpret_cast<CFStringRef>(CFArrayGetValueAtIndex(supportedTypes.get(), i));
+        String mimeType = MIMETypeForImageSourceType(supportedType);
         if (!mimeType.isEmpty()) {
             supportedImageMIMETypes->add(mimeType);
             supportedImageResourceMIMETypes->add(mimeType);
@@ -284,8 +285,8 @@
     RetainPtr<CFArrayRef> supportedTypes = adoptCF(CGImageDestinationCopyTypeIdentifiers());
     CFIndex count = CFArrayGetCount(supportedTypes.get());
     for (CFIndex i = 0; i < count; i++) {
-        RetainPtr<CFStringRef> supportedType = adoptCF(reinterpret_cast<CFStringRef>(CFArrayGetValueAtIndex(supportedTypes.get(), i)));
-        String mimeType = MIMETypeForImageSourceType(supportedType.get());
+        CFStringRef supportedType = reinterpret_cast<CFStringRef>(CFArrayGetValueAtIndex(supportedTypes.get(), i));
+        String mimeType = MIMETypeForImageSourceType(supportedType);
         if (!mimeType.isEmpty())
             supportedImageMIMETypesForEncoding->add(mimeType);
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to