Bug 186865 - Fix leaks in WebCore found by clang static analyzer in deep mode
Summary: Fix leaks in WebCore found by clang static analyzer in deep mode
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: David Kilzer (:ddkilzer)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-06-20 15:49 PDT by David Kilzer (:ddkilzer)
Modified: 2018-06-20 20:06 PDT (History)
7 users (show)

See Also:


Attachments
Patch v1 (3.21 KB, patch)
2018-06-20 15:56 PDT, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews106 for mac-sierra-wk2 (3.24 MB, application/zip)
2018-06-20 16:46 PDT, EWS Watchlist
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2018-06-20 15:49:11 PDT
Fix leaks in WebCore found by clang static analyzer in deep mode.
Comment 1 David Kilzer (:ddkilzer) 2018-06-20 15:56:05 PDT
Created attachment 343186 [details]
Patch v1
Comment 2 David Kilzer (:ddkilzer) 2018-06-20 15:58:55 PDT
Comment on attachment 343186 [details]
Patch v1

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

> Source/WebCore/platform/mac/WebCoreNSURLExtras.mm:783
> +    if (![hostNameRanges count]) {
> +        [hostNameRanges release];
>          return nil;
> +    }

I considered changing the `hostNameRanges` declaration from this:

    NSMutableArray *hostNameRanges = nil;

To this:

    RetainPtr<NSMutableArray> hostNameRanges;

And then change functions to take a RetainPtr<NSMutableArray>& instead of NSMutableArray **.

I'm happy to do that instead, although I didn't want to overthink the change.
Comment 3 Joseph Pecoraro 2018-06-20 16:01:43 PDT
Comment on attachment 343186 [details]
Patch v1

r=me
Comment 4 EWS Watchlist 2018-06-20 16:46:05 PDT
Comment on attachment 343186 [details]
Patch v1

Attachment 343186 [details] did not pass mac-wk2-ews (mac-wk2):
Output: https://webkit-queues.webkit.org/results/8270290

New failing tests:
accessibility/mac/selection-notification-focus-change.html
Comment 5 EWS Watchlist 2018-06-20 16:46:06 PDT
Created attachment 343190 [details]
Archive of layout-test-results from ews106 for mac-sierra-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews106  Port: mac-sierra-wk2  Platform: Mac OS X 10.12.6
Comment 6 David Kilzer (:ddkilzer) 2018-06-20 19:38:27 PDT
(In reply to Build Bot from comment #4)
> Comment on attachment 343186 [details]
> Patch v1
> 
> Attachment 343186 [details] did not pass mac-wk2-ews (mac-wk2):
> Output: https://webkit-queues.webkit.org/results/8270290
> 
> New failing tests:
> accessibility/mac/selection-notification-focus-change.html

Looks flakey to me without this change:
<https://webkit-test-results.webkit.org/dashboards/flakiness_dashboard.html#tests=accessibility%2Fmac%2Fselection-notification-focus-change.html>
Comment 7 WebKit Commit Bot 2018-06-20 20:05:02 PDT
Comment on attachment 343186 [details]
Patch v1

Clearing flags on attachment: 343186

Committed r233029: <https://trac.webkit.org/changeset/233029>
Comment 8 WebKit Commit Bot 2018-06-20 20:05:04 PDT
All reviewed patches have been landed.  Closing bug.
Comment 9 Radar WebKit Bug Importer 2018-06-20 20:06:27 PDT
<rdar://problem/41315464>