Skip to content
  • aestes@apple.com's avatar
    Fix issues found by the Clang Static Analyzer · a872654a
    aestes@apple.com authored
    https://bugs.webkit.org/show_bug.cgi?id=120230
    
    Reviewed by Darin Adler.
    
    Source/JavaScriptCore:
    
    * API/JSValue.mm:
    (valueToString): Don't leak every CFStringRef when in Objective-C GC.
    * API/ObjCCallbackFunction.mm:
    (JSC::ObjCCallbackFunctionImpl::~ObjCCallbackFunctionImpl): Don't
    release m_invocation's target since NSInvocation will do it for us on
    -dealloc.
    (objCCallbackFunctionForBlock): Tell NSInvocation to retain its target
    and -release our reference to the copied block.
    * API/tests/minidom.c:
    (createStringWithContentsOfFile): Free buffer before returning.
    * API/tests/testapi.c:
    (createStringWithContentsOfFile): Ditto.
    
    Source/WebCore:
    
    * WebCore.xcodeproj/project.pbxproj: Removed FoundationExtras.h.
    * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: Removed CFAutoreleaseHelper().
    (AXTextMarkerRange): Used HardAutorelease() instead of
    CFAutoreleaseHelper().
    (AXTextMarkerRangeStart): Ditto.
    (AXTextMarkerRangeEnd): Ditto.
    (textMarkerForVisiblePosition): Ditto.
    * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
    (-[WebCoreAVFMovieObserver initWithCallback:]): Called [super init]
    first so that we don't later use ivars from the wrong self.
    (-[WebCoreAVFLoaderDelegate initWithCallback:]): Ditto.
    * platform/mac/FoundationExtras.h: Removed.
    * platform/mac/KURLMac.mm:
    (WebCore::KURL::operator NSURL *): Used WTF's HardAutorelease().
    * platform/mac/WebCoreNSURLExtras.mm:
    (WebCore::mapHostNameWithRange): Used HardAutorelease() instead of
    WebCoreCFAutorelease().
    (WebCore::URLWithData): Ditto.
    (WebCore::userVisibleString): Ditto.
    (WebCore::URLByRemovingComponentAndSubsequentCharacter): Used Vector<>
    with an inline capacity rather than heap-allocating a buffer.
    * platform/mac/WebCoreObjCExtras.h: Used HardAutorelease() instead of
    WebCoreCFAutorelease().
    * platform/text/mac/StringImplMac.mm:
    (WTF::StringImpl::operator NSString *): Used WTF's HardAutorelease().
    
    Source/WebKit/mac:
    
    * Misc/WebNSFileManagerExtras.mm:
    (-[NSFileManager _webkit_startupVolumeName]): Used HardAutorelease()
    instead of WebCFAutorelease().
    * Misc/WebNSObjectExtras.h: Removed definition of WebCFAutorelease().
    * Misc/WebNSURLExtras.mm:
    (-[NSURL _web_URLWithLowercasedScheme]): Used HardAutorelease()
    instead of WebCFAutorelease().
    * Plugins/Hosted/WebHostedNetscapePluginView.mm:
    (-[WebHostedNetscapePluginView createPluginLayer]): Stop leaking
    CGColors (CALayer retains its backgroundColor property despite the
    property attributes claiming otherwise).
    * Plugins/WebBasePluginPackage.mm:
    (+[WebBasePluginPackage preferredLocalizationName]): Used
    HardAutorelease() instead of WebCFAutorelease().
    * WebView/WebDeviceOrientationProviderMock.mm:
    (-[WebDeviceOrientationProviderMockInternal lastOrientation]): Stop
    leaking WebDeviceOrientations.
    * WebView/WebPDFRepresentation.mm:
    (-[WebPDFRepresentation convertPostScriptDataSourceToPDF:]): Used
    HardAutorelease() instead of WebCFAutorelease().
    * WebView/WebView.mm:
    (+[WebView _setCacheModel:]): Ditto.
    (-[WebView _removeObjectForIdentifier:]): Ditto.
    
    Source/WebKit2:
    
    * UIProcess/API/mac/WKBrowsingContextController.mm:
    (autoreleased): Don't leak CFURLs when in Objective-C GC.
    * WebProcess/WebPage/mac/WKAccessibilityWebPageObject.mm:
    (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]):
    Don't leak CFStrings when in Objective-C GC.
    
    Source/WTF:
    
    * wtf/ObjcRuntimeExtras.h:
    (HardAutorelease): Added a canonical implementation of HardAutorelease.
    
    Tools:
    
    * DumpRenderTree/mac/DumpRenderTreePasteboard.m:
    (-[LocalPasteboard initWithName:]): Called [super init] first so that we
    don't later use ivars from the wrong self.
    * DumpRenderTree/mac/TestRunnerMac.mm:
    (-[APITestDelegate initWithCompletionCondition:]): Ditto.
    * TestWebKitAPI/Tests/WebKit2ObjC/CustomProtocolsTest.mm:
    (TestWebKitAPI::TEST): Don't leak WKProcessGroups,
    WKBrowsingContextGroups, and WKViews.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154647 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    a872654a