Bug 161597

Summary: [Mac] Address some clang static analyzer warnings in WebKit
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: WebKit Misc.Assignee: Joseph Pecoraro <joepeck>
Status: RESOLVED FIXED    
Severity: Normal CC: joepeck
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
[PATCH] Proposed Fix
none
[PATCH] Proposed Fix darin: review+

Description Joseph Pecoraro 2016-09-05 00:51:11 PDT
Address some clang static analyzer warnings in WebKit
Comment 1 Joseph Pecoraro 2016-09-05 00:55:13 PDT
Issues being addressed:

AnalyzeShallow WebFullScreenController.mm
In file included from Source/WebKit/mac/WebView/WebFullScreenController.mm:28:
Source/WebKit/mac/WebView/WebFullScreenController.h:58:10: warning: Instance variable '_isPlaying' in class 'WebFullScreenController' is never used by the methods in its @implementation (although it may be used by category methods)

AnalyzeShallow WebImmediateActionController.mm
In file included from Source/WebKit/mac/WebView/WebImmediateActionController.mm:26:
Source/WebKit/mac/WebView/WebImmediateActionController.h:54:10: warning: Instance variable '_isShowingTextIndicator' in class 'WebImmediateActionController' is never used by the methods in its @implementation (although it may be used by category methods)

AnalyzeShallow WebSelectionServiceController.mm
Source/WebKit/mac/WebCoreSupport/WebSelectionServiceController.mm:83:36: warning: Potential leak of an object stored into 'attachment'
Source/WebKit/mac/WebCoreSupport/WebSelectionServiceController.mm:85:34: warning: Potential leak of an object stored into 'cell'

AnalyzeShallow WebSharingServicePickerController.mm
Source/WebKit/mac/Misc/WebSharingServicePickerController.mm:169:32: warning: Potential leak of an object stored into 'services'

---

AnalyzeShallow WebVideoFullscreenManagerProxy.mm
Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:60:12: warning: Potential leak of an object

AnalyzeShallow WKDOMRange.mm
Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMRange.mm:150:12: warning: Potential leak of an object

AnalyzeShallow WKSharingServicePickerDelegate.mm
Source/WebKit2/UIProcess/mac/WKSharingServicePickerDelegate.mm:77:32: warning: Potential leak of an object stored into 'services'
Comment 2 Joseph Pecoraro 2016-09-05 00:55:43 PDT
Created attachment 287937 [details]
[PATCH] Proposed Fix
Comment 3 Joseph Pecoraro 2016-09-05 00:56:37 PDT
Created attachment 287938 [details]
[PATCH] Proposed Fix
Comment 4 Darin Adler 2016-09-05 10:04:22 PDT
Comment on attachment 287938 [details]
[PATCH] Proposed Fix

View in context: https://bugs.webkit.org/attachment.cgi?id=287938&action=review

> Source/WebKit/mac/WebCoreSupport/WebSelectionServiceController.mm:87
> +    RetainPtr<NSMutableAttributedString> attributedStringWithRichContent = (NSMutableAttributedString *)[NSMutableAttributedString attributedStringWithAttachment:attachment.get()];

I suggest we not use a RetainPtr here.

    NSMutableAttributedString *attributedStringWithRichContent = [NSMutableAttributedString attributedStringWithAttachment:attachment.get()];

> Source/WebKit/mac/WebCoreSupport/WebSelectionServiceController.mm:90
>      bool hasRichContentServices = hasCompatibleServicesForItems(@[ attributedStringWithRichContent.get() ]);

I suggest we not use a local variable here.
Comment 5 Joseph Pecoraro 2016-09-08 00:21:15 PDT
<https://trac.webkit.org/changeset/205592>