Bug 156956 - Fix issues found by the clang static analyzer
Summary: Fix issues found by the clang static analyzer
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Andy Estes
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-23 17:39 PDT by Andy Estes
Modified: 2017-06-16 19:13 PDT (History)
8 users (show)

See Also:


Attachments
Patch (25.55 KB, patch)
2016-04-23 18:01 PDT, Andy Estes
ap: review+
Details | Formatted Diff | Diff
patch for landing (27.72 KB, patch)
2016-04-23 18:43 PDT, Andy Estes
aestes: commit-queue-
Details | Formatted Diff | Diff
patch for landing (25.44 KB, patch)
2016-04-23 18:47 PDT, Andy Estes
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andy Estes 2016-04-23 17:39:24 PDT
Fix issues found by the clang static analyzer
Comment 1 Andy Estes 2016-04-23 18:01:30 PDT
Created attachment 277172 [details]
Patch
Comment 2 WebKit Commit Bot 2016-04-23 18:04:04 PDT
Attachment 277172 [details] did not pass style-queue:


ERROR: Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm:463:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
ERROR: Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm:463:  Extra space before ( in function call  [whitespace/parens] [4]
Total errors found: 2 in 19 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Alexey Proskuryakov 2016-04-23 18:27:41 PDT
Comment on attachment 277172 [details]
Patch

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

Fun.

> Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm:466
>  - (NSURLResponse *)response
>  {
> -    return _response.get();
> +    @synchronized (self) {
> +        return _response.get();
> +    }
>  }

I don't understand what good this is. The member variable should be aligned, so reading it is always atomic, no synchronization needed.

> Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm:509
> +- (void)dealloc
> +{
> +    [_originalRequest release];
> +    [_currentRequest release];
> +    [_error release];
> +    [_taskDescription release];
> +    [super dealloc];
> +}

I know that Alex ran NSURLSession code through leaks, surprised that this wasn't found.
Comment 4 Andy Estes 2016-04-23 18:34:16 PDT
(In reply to comment #2)
> Attachment 277172 [details] did not pass style-queue:
> 
> 
> ERROR: Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm:463: 
> Place brace on its own line for function definitions.  [whitespace/braces]
> [4]
> ERROR: Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm:463: 
> Extra space before ( in function call  [whitespace/parens] [4]
> Total errors found: 2 in 19 files
> 
> 
> If any of these errors are false positives, please file a bug against
> check-webkit-style.

Filed https://bugs.webkit.org/show_bug.cgi?id=156957
Comment 5 Andy Estes 2016-04-23 18:36:20 PDT
(In reply to comment #3)
> Comment on attachment 277172 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=277172&action=review
> 
> Fun.
> 
> > Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm:466
> >  - (NSURLResponse *)response
> >  {
> > -    return _response.get();
> > +    @synchronized (self) {
> > +        return _response.get();
> > +    }
> >  }
> 
> I don't understand what good this is. The member variable should be aligned,
> so reading it is always atomic, no synchronization needed.

Perhaps you're right. I didn't think too much about this. I'll remove it.

> 
> > Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm:509
> > +- (void)dealloc
> > +{
> > +    [_originalRequest release];
> > +    [_currentRequest release];
> > +    [_error release];
> > +    [_taskDescription release];
> > +    [super dealloc];
> > +}
> 
> I know that Alex ran NSURLSession code through leaks, surprised that this
> wasn't found.

I think this is code added by Jer for AVFoundation loading, perhaps written after Alex did his check.

Thanks for the review!
Comment 6 Andy Estes 2016-04-23 18:43:57 PDT
Created attachment 277174 [details]
patch for landing
Comment 7 Andy Estes 2016-04-23 18:47:17 PDT
Created attachment 277175 [details]
patch for landing
Comment 8 WebKit Commit Bot 2016-04-23 19:49:27 PDT
Comment on attachment 277175 [details]
patch for landing

Clearing flags on attachment: 277175

Committed r199960: <http://trac.webkit.org/changeset/199960>
Comment 9 Joseph Pecoraro 2017-06-16 19:13:51 PDT
Nice changes!

Closing this bug as it landed a while ago.