Changeset 167746 in webkit
- Timestamp:
- Apr 23, 2014 9:46:28 PM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r167744 r167746 1 2014-04-23 Darin Adler <darin@apple.com> 2 3 [Cocoa] fix CF leaks found by code inspection 4 https://bugs.webkit.org/show_bug.cgi?id=132106 5 6 Reviewed by Andreas Kling. 7 8 * page/CaptionUserPreferencesMediaAF.cpp: 9 (WebCore::trackDisplayName): Added a missing adoptCF. 10 11 * platform/Language.cpp: 12 (WebCore::displayNameForLanguageLocale): Added a missing adoptCF. 13 14 * platform/graphics/FontPlatformData.cpp: 15 (WebCore::FontPlatformData::openTypeTable): Added a missing adoptCF. 16 17 * platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.cpp: 18 (WebCore::InbandTextTrackPrivateAVCF::label): Added two missing adoptCF. 19 20 * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp: 21 (WebCore::AVFWrapper::createImageForTimeInRect): Added two missing adoptCF. 22 23 * platform/graphics/cg/PDFDocumentImage.cpp: 24 (WebCore::PDFDocumentImage::createPDFDocument): Added missing adoptCF. 25 26 * platform/graphics/cocoa/FontPlatformDataCocoa.mm: 27 (WebCore::cascadeToLastResortFontDescriptor): Added two missing adoptCF. 28 29 * platform/graphics/mac/FontMac.mm: 30 (WebCore::Font::primaryFontDataIsSystemFont): Added missing adoptCF. 31 32 * platform/graphics/mac/SimpleFontDataMac.mm: 33 (WebCore::hasCustomTracking): Added missing adoptCF. 34 35 * platform/image-decoders/ImageDecoder.h: 36 (WebCore::ImageDecoder::qcmsOutputDeviceProfile): Added CFRelease. 37 38 * plugins/mac/PluginPackageMac.cpp: 39 (WebCore::readPListFile): Added two missing adoptCF. 40 1 41 2014-04-23 Ryosuke Niwa <rniwa@webkit.org> 2 42 -
trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp
r165607 r167746 609 609 } 610 610 } else { 611 String languageAndLocale = CFLocaleCopyDisplayNameForPropertyValue(currentLocale.get(), kCFLocaleIdentifier, trackLanguageIdentifier.createCFString().get());611 String languageAndLocale = adoptCF(CFLocaleCopyDisplayNameForPropertyValue(currentLocale.get(), kCFLocaleIdentifier, trackLanguageIdentifier.createCFString().get())).get(); 612 612 if (!languageAndLocale.isEmpty()) 613 613 displayName.append(languageAndLocale); -
trunk/Source/WebCore/platform/Language.cpp
r165607 r167746 149 149 { 150 150 #if USE(CF) && !PLATFORM(WIN) 151 if (!localeName.isNull() && !localeName.isEmpty()) { 152 RetainPtr<CFLocaleRef> currentLocale = adoptCF(CFLocaleCopyCurrent()); 153 return CFLocaleCopyDisplayNameForPropertyValue(currentLocale.get(), kCFLocaleIdentifier, localeName.createCFString().get()); 154 } 151 if (!localeName.isEmpty()) 152 return adoptCF(CFLocaleCopyDisplayNameForPropertyValue(adoptCF(CFLocaleCopyCurrent()).get(), kCFLocaleIdentifier, localeName.createCFString().get())).get(); 155 153 #endif 156 154 return localeName; -
trunk/Source/WebCore/platform/graphics/FontPlatformData.cpp
r166633 r167746 178 178 PassRefPtr<SharedBuffer> FontPlatformData::openTypeTable(uint32_t table) const 179 179 { 180 if ( CFDataRef data = CGFontCopyTableForTag(cgFont(), table))181 return SharedBuffer::wrapCFData(data );180 if (RetainPtr<CFDataRef> data = adoptCF(CGFontCopyTableForTag(cgFont(), table))) 181 return SharedBuffer::wrapCFData(data.get()); 182 182 183 183 return nullptr; -
trunk/Source/WebCore/platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.cpp
r165676 r167746 149 149 150 150 // If possible, return a title in one of the user's preferred languages. 151 RetainPtr<CFArrayRef> preferredLanguages = CFLocaleCopyPreferredLanguages();152 RetainPtr<CFArrayRef> titlesForPreferredLanguages = AVCFMediaSelectionCopyOptionsFromArrayFilteredAndSortedAccordingToPreferredLanguages(titles.get(), preferredLanguages.get());151 RetainPtr<CFArrayRef> preferredLanguages = adoptCF(CFLocaleCopyPreferredLanguages()); 152 RetainPtr<CFArrayRef> titlesForPreferredLanguages = adoptCF(AVCFMediaSelectionCopyOptionsFromArrayFilteredAndSortedAccordingToPreferredLanguages(titles.get(), preferredLanguages.get())); 153 153 CFIndex preferredTitlesCount = CFArrayGetCount(titlesForPreferredLanguages.get()); 154 154 if (preferredTitlesCount) { -
trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp
r167632 r167746 1758 1758 1759 1759 AVCFAssetImageGeneratorSetMaximumSize(m_imageGenerator.get(), CGSize(rect.size())); 1760 CGImageRef rawimage = AVCFAssetImageGeneratorCopyCGImageAtTime(m_imageGenerator.get(), CMTimeMakeWithSeconds(time, 600), 0, 0); 1761 CGImageRef image = CGImageCreateCopyWithColorSpace(rawimage, CGColorSpaceCreateDeviceRGB()); 1760 RetainPtr<CGImageRef> rawimage = adoptCF(AVCFAssetImageGeneratorCopyCGImageAtTime(m_imageGenerator.get(), CMTimeMakeWithSeconds(time, 600), 0, 0)); 1761 RetainPtr<CGImageRef> image = adoptCF(CGImageCreateCopyWithColorSpace(rawimage.get(), adoptCF(CGColorSpaceCreateDeviceRGB()).get())); 1762 1762 1763 #if !LOG_DISABLED 1763 1764 double duration = monotonicallyIncreasingTime() - start; -
trunk/Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp
r166582 r167746 210 210 211 211 #if !USE(PDFKIT_FOR_PDFDOCUMENTIMAGE) 212 212 213 void PDFDocumentImage::createPDFDocument() 213 214 { 214 215 RetainPtr<CGDataProviderRef> dataProvider = adoptCF(CGDataProviderCreateWithCFData(data()->createCFData().get())); 215 m_document = CGPDFDocumentCreateWithProvider(dataProvider.get());216 m_document = adoptCF(CGPDFDocumentCreateWithProvider(dataProvider.get())); 216 217 } 217 218 … … 257 258 CGContextDrawPDFPage(context->platformContext(), CGPDFDocumentGetPage(m_document.get(), 1)); 258 259 } 260 259 261 #endif // !USE(PDFKIT_FOR_PDFDOCUMENTIMAGE) 260 262 -
trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm
r166603 r167746 273 273 return descriptor; 274 274 275 RetainPtr<CTFontDescriptorRef> lastResort = adoptCF(CTFontDescriptorCreateWithNameAndSize(CFSTR("LastResort"), 0)); 276 277 const void* descriptors[] = { lastResort.get() }; 278 RetainPtr<CFArrayRef> array = adoptCF(CFArrayCreate(kCFAllocatorDefault, descriptors, WTF_ARRAY_LENGTH(descriptors), &kCFTypeArrayCallBacks)); 279 275 280 const void* keys[] = { kCTFontCascadeListAttribute }; 276 const void* descriptors[] = { CTFontDescriptorCreateWithNameAndSize(CFSTR("LastResort"), 0) }; 277 const void* values[] = { CFArrayCreate(kCFAllocatorDefault, descriptors, WTF_ARRAY_LENGTH(descriptors), &kCFTypeArrayCallBacks) }; 281 const void* values[] = { array.get() }; 278 282 RetainPtr<CFDictionaryRef> attributes = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, keys, values, WTF_ARRAY_LENGTH(keys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); 279 283 -
trunk/Source/WebCore/platform/graphics/mac/FontMac.mm
r167724 r167746 544 544 { 545 545 #if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED > 1090 546 RetainPtr<CTFontDescriptorRef> descriptor = CTFontCopyFontDescriptor(primaryFont()->platformData().ctFont()); 547 return CTFontDescriptorIsSystemUIFont(descriptor.get()); 546 return CTFontDescriptorIsSystemUIFont(adoptCF(CTFontCopyFontDescriptor(primaryFont()->platformData().ctFont())).get()); 548 547 #else 549 548 // System fonts are hidden by having a name that begins with a period, so simply search -
trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm
r167683 r167746 373 373 return false; 374 374 #else 375 RetainPtr<CTFontDescriptorRef> descriptor = CTFontCopyFontDescriptor(font); 376 return CTFontDescriptorIsSystemUIFont(descriptor.get()); 375 return CTFontDescriptorIsSystemUIFont(adoptCF(CTFontCopyFontDescriptor(font)).get()); 377 376 #endif 378 377 } -
trunk/Source/WebCore/platform/image-decoders/ImageDecoder.h
r165676 r167746 321 321 const unsigned char* systemProfile = CFDataGetBytePtr(iccProfile); 322 322 outputDeviceProfile = qcms_profile_from_memory(systemProfile, length); 323 CFRelease(iccProfile); 323 324 } 324 325 #else -
trunk/Source/WebCore/plugins/mac/PluginPackageMac.cpp
r165676 r167746 29 29 #include "PluginPackage.h" 30 30 31 #include <wtf/RetainPtr.h>32 31 #include "MIMETypeRegistry.h" 33 #include "npruntime_impl.h"34 32 #include "PluginDatabase.h" 35 33 #include "PluginDebug.h" 36 34 #include "WebCoreNSStringExtras.h" 35 #include "npruntime_impl.h" 36 #include <CoreFoundation/CoreFoundation.h> 37 #include <wtf/RetainPtr.h> 37 38 #include <wtf/text/CString.h> 38 39 #include <CoreFoundation/CoreFoundation.h>40 39 41 40 #define PluginNameOrDescriptionStringNumber 126 … … 68 67 typedef void (*BP_CreatePluginMIMETypesPreferencesFuncPtr)(void); 69 68 70 static WTF::RetainPtr<CFDictionaryRef> readPListFile(CFStringRef fileName, bool createFile, CFBundleRef bundle)69 static RetainPtr<CFDictionaryRef> readPListFile(CFStringRef fileName, bool createFile, CFBundleRef bundle) 71 70 { 72 71 if (createFile) { … … 77 76 } 78 77 79 WTF::RetainPtr<CFDictionaryRef> map; 80 WTF::RetainPtr<CFURLRef> url = 81 CFURLCreateWithFileSystemPath(kCFAllocatorDefault, fileName, kCFURLPOSIXPathStyle, false); 78 RetainPtr<CFDictionaryRef> map; 79 RetainPtr<CFURLRef> url = adoptCF(CFURLCreateWithFileSystemPath(kCFAllocatorDefault, fileName, kCFURLPOSIXPathStyle, false)); 82 80 83 81 CFDataRef resource = 0; … … 86 84 return map; 87 85 88 WTF::RetainPtr<CFPropertyListRef> propertyList = 89 CFPropertyListCreateFromXMLData(kCFAllocatorDefault, resource, kCFPropertyListImmutable, 0); 86 RetainPtr<CFPropertyListRef> propertyList = adoptCF(CFPropertyListCreateFromXMLData(kCFAllocatorDefault, resource, kCFPropertyListImmutable, 0)); 90 87 91 88 CFRelease(resource); … … 120 117 for (SInt16 i = 0; i < count; ++i) { 121 118 unsigned char length = *p; 122 WTF::RetainPtr<CFStringRef> str = adoptCF(CFStringCreateWithPascalString(0, p, encoding));119 RetainPtr<CFStringRef> str = adoptCF(CFStringCreateWithPascalString(0, p, encoding)); 123 120 list.append(str.get()); 124 121 p += 1 + length; … … 133 130 return false; 134 131 135 WTF::RetainPtr<CFDictionaryRef> mimeDict;136 137 WTF::RetainPtr<CFTypeRef> mimeTypesFileName = CFBundleGetValueForInfoDictionaryKey(m_module, CFSTR("WebPluginMIMETypesFilename"));132 RetainPtr<CFDictionaryRef> mimeDict; 133 134 RetainPtr<CFTypeRef> mimeTypesFileName = CFBundleGetValueForInfoDictionaryKey(m_module, CFSTR("WebPluginMIMETypesFilename")); 138 135 if (mimeTypesFileName && CFGetTypeID(mimeTypesFileName.get()) == CFStringGetTypeID()) { 139 136 140 WTF::RetainPtr<CFStringRef> fileName = (CFStringRef)mimeTypesFileName.get();141 WTF::RetainPtr<CFStringRef> homeDir = adoptCF(homeDirectoryPath().createCFString());142 WTF::RetainPtr<CFStringRef> path = adoptCF(CFStringCreateWithFormat(0, 0, CFSTR("%@/Library/Preferences/%@"), homeDir.get(), fileName.get()));143 144 WTF::RetainPtr<CFDictionaryRef> plist = readPListFile(path.get(), /*createFile*/ false, m_module);137 RetainPtr<CFStringRef> fileName = (CFStringRef)mimeTypesFileName.get(); 138 RetainPtr<CFStringRef> homeDir = homeDirectoryPath().createCFString(); 139 RetainPtr<CFStringRef> path = adoptCF(CFStringCreateWithFormat(0, 0, CFSTR("%@/Library/Preferences/%@"), homeDir.get(), fileName.get())); 140 141 RetainPtr<CFDictionaryRef> plist = readPListFile(path.get(), /*createFile*/ false, m_module); 145 142 if (plist) { 146 143 // If the plist isn't localized, have the plug-in recreate it in the preferred language. 147 WTF::RetainPtr<CFStringRef> localizationName =144 RetainPtr<CFStringRef> localizationName = 148 145 (CFStringRef)CFDictionaryGetValue(plist.get(), CFSTR("WebPluginLocalizationName")); 149 146 CFLocaleRef locale = CFLocaleCopyCurrent(); … … 173 170 mimeType = mimeType.lower(); 174 171 175 WTF::RetainPtr<CFDictionaryRef> extensionsDict = (CFDictionaryRef)values[i];176 177 WTF::RetainPtr<CFNumberRef> enabled = (CFNumberRef)CFDictionaryGetValue(extensionsDict.get(), CFSTR("WebPluginTypeEnabled"));172 RetainPtr<CFDictionaryRef> extensionsDict = (CFDictionaryRef)values[i]; 173 174 RetainPtr<CFNumberRef> enabled = (CFNumberRef)CFDictionaryGetValue(extensionsDict.get(), CFSTR("WebPluginTypeEnabled")); 178 175 if (enabled) { 179 176 int enabledValue = 0; … … 183 180 184 181 Vector<String> mimeExtensions; 185 WTF::RetainPtr<CFArrayRef> extensions = (CFArrayRef)CFDictionaryGetValue(extensionsDict.get(), CFSTR("WebPluginExtensions"));182 RetainPtr<CFArrayRef> extensions = (CFArrayRef)CFDictionaryGetValue(extensionsDict.get(), CFSTR("WebPluginExtensions")); 186 183 if (extensions) { 187 184 CFIndex extensionCount = CFArrayGetCount(extensions.get()); … … 256 253 } 257 254 258 WTF::RetainPtr<CFStringRef> path = adoptCF(m_path.createCFString());259 WTF::RetainPtr<CFURLRef> url = adoptCF(CFURLCreateWithFileSystemPath(kCFAllocatorDefault, path.get(),255 RetainPtr<CFStringRef> path = m_path.createCFString(); 256 RetainPtr<CFURLRef> url = adoptCF(CFURLCreateWithFileSystemPath(kCFAllocatorDefault, path.get(), 260 257 kCFURLPOSIXPathStyle, false)); 261 258 m_module = CFBundleCreate(NULL, url.get());
Note: See TracChangeset
for help on using the changeset viewer.