Title: [232187] trunk/Source
Revision
232187
Author
[email protected]
Date
2018-05-25 07:19:58 -0700 (Fri, 25 May 2018)

Log Message

Fix issues with -dealloc methods found by clang static analyzer
<https://webkit.org/b/185887>

Reviewed by Joseph Pecoraro.

Source/_javascript_Core:

* API/JSValue.mm:
(-[JSValue dealloc]):
(-[JSValue description]):
- Move method implementations from (Internal) category to the
  main category since these are public API.  This fixes the
  false positive warning about a missing -dealloc method.

Source/WebCore:

* platform/ios/WebAVPlayerController.mm:
(-[WebAVPlayerController dealloc]): Release `_minTiming` and
`_maxTiming` to fix leaks.
* platform/ios/WebBackgroundTaskController.mm:
(-[WebBackgroundTaskController dealloc]): Release
`_backgroundTaskStartBlock` and `_backgroundTaskEndBlock` to fix
leaks.
* platform/ios/WebItemProviderPasteboard.mm:
(-[WebItemProviderRegistrationInfoList dealloc]): Release
`_teamData` to fix leak.

Source/WebKit:

* UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: Drive-by fix
to use `copy` for `mimeType` property.
(-[_WKPreviewControllerDataSource initWithMIMEType:]): Drive-by
fix to use `instancetype` instead of `id`.  Use -copy for
`mimeType` argument to match property definition.
(-[_WKPreviewControllerDataSource dealloc]): Add.  Release
`_completionHandler` and `_mimeType` to fix leaks.
* UIProcess/ios/WKPasswordView.mm:
(-[WKPasswordView dealloc]): Add.  Release
`_userDidEnterPassword` to fix leak.
* UIProcess/ios/fullscreen/WKFullScreenViewController.h:
Drive-by clean-up to make `location` property `copy` instead of
`retain`.
* UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
(-[WKFullScreenViewController dealloc]): Release `_target` and
`_location` to fix leaks.
* UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
(-[WKFullscreenAnimationController dealloc]): Add.  Release
`_viewController` to fix leak.
* UIProcess/ios/fullscreen/WKFullscreenStackView.mm:
(@property secondaryMaterialOverlayView): Mark explicitly as
`assign` since this isn't a retained variable.
(@property secondaryMaterialOverlayViewConstraints): Mark
explicitly as `retain` since there is nothing to keep this
object alive.
(+[WKFullscreenStackView secondaryMaterialOverlayView]): Fix
leak by autoreleasing the return value.
(-[WKFullscreenStackView dealloc]): Release retained instance
variables to fix leaks.  Note that `_stackView` and
`_visualEffectView` are internally retained despite their
@property declarations.
(-[WKFullscreenStackView setTargetViewForSecondaryMaterialOverlay:]):
Retain @property targetViewForSecondaryMaterialOverlay to match
its declaration.

Source/WebKitLegacy/mac:

* WebView/WebView.mm:
(-[WebUITextIndicatorData dealloc]):
- Move method implementation from (WebUITextIndicatorInternal)
  category to the main category since this is public API.  This
  fixes the false positive warning about a missing -dealloc
  method.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/API/JSValue.mm (232186 => 232187)


--- trunk/Source/_javascript_Core/API/JSValue.mm	2018-05-25 13:47:11 UTC (rev 232186)
+++ trunk/Source/_javascript_Core/API/JSValue.mm	2018-05-25 14:19:58 UTC (rev 232187)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -66,6 +66,21 @@
     JSValueRef m_value;
 }
 
+- (void)dealloc
+{
+    JSValueUnprotect([_context JSGlobalContextRef], m_value);
+    [_context release];
+    _context = nil;
+    [super dealloc];
+}
+
+- (NSString *)description
+{
+    if (id wrapped = tryUnwrapObjcObject([_context JSGlobalContextRef], m_value))
+        return [wrapped description];
+    return [self toString];
+}
+
 - (JSValueRef)JSValueRef
 {
     return m_value;
@@ -1138,21 +1153,6 @@
     return handler ? handler->valueToTypeSEL : nil;
 }
 
-- (void)dealloc
-{
-    JSValueUnprotect([_context JSGlobalContextRef], m_value);
-    [_context release];
-    _context = nil;
-    [super dealloc];
-}
-
-- (NSString *)description
-{
-    if (id wrapped = tryUnwrapObjcObject([_context JSGlobalContextRef], m_value))
-        return [wrapped description];
-    return [self toString];
-}
-
 NSInvocation *typeToValueInvocationFor(const char* encodedType)
 {
     SEL selector = [JSValue selectorForStructToValue:encodedType];

Modified: trunk/Source/_javascript_Core/ChangeLog (232186 => 232187)


--- trunk/Source/_javascript_Core/ChangeLog	2018-05-25 13:47:11 UTC (rev 232186)
+++ trunk/Source/_javascript_Core/ChangeLog	2018-05-25 14:19:58 UTC (rev 232187)
@@ -1,3 +1,17 @@
+2018-05-25  David Kilzer  <[email protected]>
+
+        Fix issues with -dealloc methods found by clang static analyzer
+        <https://webkit.org/b/185887>
+
+        Reviewed by Joseph Pecoraro.
+
+        * API/JSValue.mm:
+        (-[JSValue dealloc]):
+        (-[JSValue description]):
+        - Move method implementations from (Internal) category to the
+          main category since these are public API.  This fixes the
+          false positive warning about a missing -dealloc method.
+
 2018-05-24  Yusuke Suzuki  <[email protected]>
 
         [Baseline] Remove a hack for DCE removal of NewFunction

Modified: trunk/Source/WebCore/ChangeLog (232186 => 232187)


--- trunk/Source/WebCore/ChangeLog	2018-05-25 13:47:11 UTC (rev 232186)
+++ trunk/Source/WebCore/ChangeLog	2018-05-25 14:19:58 UTC (rev 232187)
@@ -1,3 +1,21 @@
+2018-05-25  David Kilzer  <[email protected]>
+
+        Fix issues with -dealloc methods found by clang static analyzer
+        <https://webkit.org/b/185887>
+
+        Reviewed by Joseph Pecoraro.
+
+        * platform/ios/WebAVPlayerController.mm:
+        (-[WebAVPlayerController dealloc]): Release `_minTiming` and
+        `_maxTiming` to fix leaks.
+        * platform/ios/WebBackgroundTaskController.mm:
+        (-[WebBackgroundTaskController dealloc]): Release
+        `_backgroundTaskStartBlock` and `_backgroundTaskEndBlock` to fix
+        leaks.
+        * platform/ios/WebItemProviderPasteboard.mm:
+        (-[WebItemProviderRegistrationInfoList dealloc]): Release
+        `_teamData` to fix leak.
+
 2018-05-25  Antoine Quint  <[email protected]>
 
         [Web Animations] WebAnimation objects never get destroyed

Modified: trunk/Source/WebCore/platform/ios/WebAVPlayerController.mm (232186 => 232187)


--- trunk/Source/WebCore/platform/ios/WebAVPlayerController.mm	2018-05-25 13:47:11 UTC (rev 232186)
+++ trunk/Source/WebCore/platform/ios/WebAVPlayerController.mm	2018-05-25 14:19:58 UTC (rev 232187)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -90,6 +90,8 @@
     [_currentAudioMediaSelectionOption release];
     [_currentLegibleMediaSelectionOption release];
     [_externalPlaybackAirPlayDeviceLocalizedName release];
+    [_minTiming release];
+    [_maxTiming release];
     [super dealloc];
 }
 

Modified: trunk/Source/WebCore/platform/ios/WebBackgroundTaskController.mm (232186 => 232187)


--- trunk/Source/WebCore/platform/ios/WebBackgroundTaskController.mm	2018-05-25 13:47:11 UTC (rev 232186)
+++ trunk/Source/WebCore/platform/ios/WebBackgroundTaskController.mm	2018-05-25 14:19:58 UTC (rev 232187)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2017-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -40,6 +40,8 @@
 
 - (void)dealloc
 {
+    [_backgroundTaskStartBlock release];
+    [_backgroundTaskEndBlock release];
     [super dealloc];
 }
 

Modified: trunk/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm (232186 => 232187)


--- trunk/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm	2018-05-25 13:47:11 UTC (rev 232186)
+++ trunk/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm	2018-05-25 14:19:58 UTC (rev 232187)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2017-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -214,6 +214,7 @@
 - (void)dealloc
 {
     [_suggestedName release];
+    [_teamData release];
     [super dealloc];
 }
 

Modified: trunk/Source/WebKit/ChangeLog (232186 => 232187)


--- trunk/Source/WebKit/ChangeLog	2018-05-25 13:47:11 UTC (rev 232186)
+++ trunk/Source/WebKit/ChangeLog	2018-05-25 14:19:58 UTC (rev 232187)
@@ -1,3 +1,45 @@
+2018-05-25  David Kilzer  <[email protected]>
+
+        Fix issues with -dealloc methods found by clang static analyzer
+        <https://webkit.org/b/185887>
+
+        Reviewed by Joseph Pecoraro.
+
+        * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: Drive-by fix
+        to use `copy` for `mimeType` property.
+        (-[_WKPreviewControllerDataSource initWithMIMEType:]): Drive-by
+        fix to use `instancetype` instead of `id`.  Use -copy for
+        `mimeType` argument to match property definition.
+        (-[_WKPreviewControllerDataSource dealloc]): Add.  Release
+        `_completionHandler` and `_mimeType` to fix leaks.
+        * UIProcess/ios/WKPasswordView.mm:
+        (-[WKPasswordView dealloc]): Add.  Release
+        `_userDidEnterPassword` to fix leak.
+        * UIProcess/ios/fullscreen/WKFullScreenViewController.h:
+        Drive-by clean-up to make `location` property `copy` instead of
+        `retain`.
+        * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
+        (-[WKFullScreenViewController dealloc]): Release `_target` and
+        `_location` to fix leaks.
+        * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
+        (-[WKFullscreenAnimationController dealloc]): Add.  Release
+        `_viewController` to fix leak.
+        * UIProcess/ios/fullscreen/WKFullscreenStackView.mm:
+        (@property secondaryMaterialOverlayView): Mark explicitly as
+        `assign` since this isn't a retained variable.
+        (@property secondaryMaterialOverlayViewConstraints): Mark
+        explicitly as `retain` since there is nothing to keep this
+        object alive.
+        (+[WKFullscreenStackView secondaryMaterialOverlayView]): Fix
+        leak by autoreleasing the return value.
+        (-[WKFullscreenStackView dealloc]): Release retained instance
+        variables to fix leaks.  Note that `_stackView` and
+        `_visualEffectView` are internally retained despite their
+        @property declarations.
+        (-[WKFullscreenStackView setTargetViewForSecondaryMaterialOverlay:]):
+        Retain @property targetViewForSecondaryMaterialOverlay to match
+        its declaration.
+
 2018-05-23  Antoine Quint  <[email protected]>
 
         [Web Animations] Use DEFAULT_EXPERIMENTAL_FEATURES_ENABLED for Web Animations experimental features

Modified: trunk/Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm (232186 => 232187)


--- trunk/Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm	2018-05-25 13:47:11 UTC (rev 232186)
+++ trunk/Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm	2018-05-25 14:19:58 UTC (rev 232187)
@@ -51,22 +51,29 @@
 };
 
 @property (strong) NSItemProviderCompletionHandler completionHandler;
-@property (retain) NSString *mimeType;
+@property (copy) NSString *mimeType;
 
 @end
 
 @implementation _WKPreviewControllerDataSource
 
-- (id)initWithMIMEType:(NSString*)mimeType
+- (instancetype)initWithMIMEType:(NSString*)mimeType
 {
     if (!(self = [super init]))
         return nil;
 
-    self.mimeType = mimeType;
+    _mimeType = [mimeType copy];
 
     return self;
 }
 
+- (void)dealloc
+{
+    [_completionHandler release];
+    [_mimeType release];
+    [super dealloc];
+}
+
 - (NSInteger)numberOfPreviewItemsInPreviewController:(QLPreviewController *)controller
 {
     return 1;

Modified: trunk/Source/WebKit/UIProcess/ios/WKPasswordView.mm (232186 => 232187)


--- trunk/Source/WebKit/UIProcess/ios/WKPasswordView.mm	2018-05-25 13:47:11 UTC (rev 232186)
+++ trunk/Source/WebKit/UIProcess/ios/WKPasswordView.mm	2018-05-25 14:19:58 UTC (rev 232187)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2017-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -69,6 +69,12 @@
     return self;
 }
 
+- (void)dealloc
+{
+    [_userDidEnterPassword release];
+    [super dealloc];
+}
+
 - (NSString *)documentName
 {
     return _documentName.get();

Modified: trunk/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenViewController.h (232186 => 232187)


--- trunk/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenViewController.h	2018-05-25 13:47:11 UTC (rev 232186)
+++ trunk/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenViewController.h	2018-05-25 14:19:58 UTC (rev 232187)
@@ -36,7 +36,7 @@
 @interface WKFullScreenViewController : UIViewController
 @property (retain, nonatomic) id target;
 @property (assign, nonatomic) SEL action;
-@property (retain, nonatomic) NSString *location;
+@property (copy, nonatomic) NSString *location;
 @property (assign, nonatomic) BOOL prefersStatusBarHidden;
 @property (assign, nonatomic, getter=isPlaying) BOOL playing;
 @property (assign, nonatomic, getter=isPictureInPictureActive) BOOL pictureInPictureActive;

Modified: trunk/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenViewController.mm (232186 => 232187)


--- trunk/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenViewController.mm	2018-05-25 13:47:11 UTC (rev 232186)
+++ trunk/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenViewController.mm	2018-05-25 14:19:58 UTC (rev 232187)
@@ -148,6 +148,9 @@
 
     _playbackClient.setInterface(nullptr);
 
+    [_target release];
+    [_location release];
+
     [super dealloc];
 }
 

Modified: trunk/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm (232186 => 232187)


--- trunk/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm	2018-05-25 13:47:11 UTC (rev 232186)
+++ trunk/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm	2018-05-25 14:19:58 UTC (rev 232187)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2017-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -148,6 +148,12 @@
     CGFloat _finalBackgroundAlpha;
 }
 
+- (void)dealloc
+{
+    [_viewController release];
+    [super dealloc];
+}
+
 - (void)_createViewsForTransitionContext:(id<UIViewControllerContextTransitioning>)transitionContext
 {
     _maskView = adoptNS([[UIView alloc] init]);

Modified: trunk/Source/WebKit/UIProcess/ios/fullscreen/WKFullscreenStackView.mm (232186 => 232187)


--- trunk/Source/WebKit/UIProcess/ios/fullscreen/WKFullscreenStackView.mm	2018-05-25 13:47:11 UTC (rev 232186)
+++ trunk/Source/WebKit/UIProcess/ios/fullscreen/WKFullscreenStackView.mm	2018-05-25 14:19:58 UTC (rev 232187)
@@ -66,8 +66,8 @@
 @interface WKFullscreenStackView ()
 @property (nonatomic, readonly) UIStackView *_stackView;
 @property (nonatomic, readonly) UIVisualEffectView *_visualEffectView;
-@property (nonatomic) UIVisualEffectView *secondaryMaterialOverlayView;
-@property (nonatomic) NSArray<NSLayoutConstraint *> *secondaryMaterialOverlayViewConstraints;
+@property (nonatomic, assign) UIVisualEffectView *secondaryMaterialOverlayView;
+@property (nonatomic, retain) NSArray<NSLayoutConstraint *> *secondaryMaterialOverlayViewConstraints;
 @end
 
 @implementation WKFullscreenStackView
@@ -104,7 +104,7 @@
     UIVisualEffectView *secondaryMaterialOverlayView = [[UIVisualEffectView alloc] initWithEffect:nil];
     [secondaryMaterialOverlayView setUserInteractionEnabled:NO];
     [secondaryMaterialOverlayView setBackgroundEffects:@[[UIVisualEffect effectCompositingColor:[UIColor blackColor] withMode:UICompositingModePlusDarker alpha:0.06]]];
-    return secondaryMaterialOverlayView;
+    return [secondaryMaterialOverlayView autorelease];
 }
 
 #pragma mark - External Interface
@@ -143,12 +143,21 @@
     return self;
 }
 
+- (void)dealloc
+{
+    [_targetViewForSecondaryMaterialOverlay release];
+    [_visualEffectView release];
+    [_stackView release];
+    [_secondaryMaterialOverlayViewConstraints release];
+    [super dealloc];
+}
+
 - (void)setTargetViewForSecondaryMaterialOverlay:(UIView *)targetViewForSecondaryMaterialOverlay
 {
     if (_targetViewForSecondaryMaterialOverlay == targetViewForSecondaryMaterialOverlay)
         return;
 
-    _targetViewForSecondaryMaterialOverlay = targetViewForSecondaryMaterialOverlay;
+    _targetViewForSecondaryMaterialOverlay = [targetViewForSecondaryMaterialOverlay retain];
     [self setNeedsUpdateConstraints];
 }
 

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (232186 => 232187)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2018-05-25 13:47:11 UTC (rev 232186)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2018-05-25 14:19:58 UTC (rev 232187)
@@ -1,3 +1,17 @@
+2018-05-25  David Kilzer  <[email protected]>
+
+        Fix issues with -dealloc methods found by clang static analyzer
+        <https://webkit.org/b/185887>
+
+        Reviewed by Joseph Pecoraro.
+
+        * WebView/WebView.mm:
+        (-[WebUITextIndicatorData dealloc]):
+        - Move method implementation from (WebUITextIndicatorInternal)
+          category to the main category since this is public API.  This
+          fixes the false positive warning about a missing -dealloc
+          method.
+
 2018-05-24  Sam Weinig  <[email protected]>
 
         Modernize RenderStyleConstants.h - Part 2

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebView.mm (232186 => 232187)


--- trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2018-05-25 13:47:11 UTC (rev 232186)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2018-05-25 14:19:58 UTC (rev 232187)
@@ -660,6 +660,18 @@
 @synthesize contentImage=_contentImage;
 @synthesize estimatedBackgroundColor=_estimatedBackgroundColor;
 
+- (void)dealloc
+{
+    [_dataInteractionImage release];
+    [_textRectsInBoundingRectCoordinates release];
+    [_contentImageWithHighlight release];
+    [_contentImageWithoutSelection release];
+    [_contentImage release];
+    [_estimatedBackgroundColor release];
+
+    [super dealloc];
+}
+
 @end
 
 @implementation WebUITextIndicatorData (WebUITextIndicatorInternal)
@@ -707,18 +719,6 @@
     return self;
 }
 
-- (void)dealloc
-{
-    [_dataInteractionImage release];
-    [_textRectsInBoundingRectCoordinates release];
-    [_contentImageWithHighlight release];
-    [_contentImageWithoutSelection release];
-    [_contentImage release];
-    [_estimatedBackgroundColor release];
-    
-    [super dealloc];
-}
-
 @end
 #elif !PLATFORM(MAC)
 @implementation WebUITextIndicatorData
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to