Bug 161597 - [Mac] Address some clang static analyzer warnings in WebKit
Summary: [Mac] Address some clang static analyzer warnings in WebKit
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Joseph Pecoraro
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-05 00:51 PDT by Joseph Pecoraro
Modified: 2016-09-08 16:29 PDT (History)
1 user (show)

See Also:


Attachments
[PATCH] Proposed Fix (7.77 KB, patch)
2016-09-05 00:55 PDT, Joseph Pecoraro
no flags Details | Formatted Diff | Diff
[PATCH] Proposed Fix (7.82 KB, patch)
2016-09-05 00:56 PDT, Joseph Pecoraro
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>