Static Analyzer: Address some leaks in MiniBrowser
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Feb 2017 04:19:24 +0000 (04:19 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Feb 2017 04:19:24 +0000 (04:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=167897

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-02-06
Reviewed by Alexey Proskuryakov.

* MiniBrowser/mac/BrowserWindowController.m:
(-[BrowserWindowController sharingService:transitionImageForShareItem:contentRect:]):
* MiniBrowser/mac/ExtensionManagerWindowController.m:
(-[ExtensionManagerWindowController add:]):
(-[ExtensionManagerWindowController remove:]):
* MiniBrowser/mac/SettingsController.m:
(-[SettingsController _populateMenu]):
(-[SettingsController togglePerWindowWebProcessesDisabled:]):
Address obvious leaks caught by the static analyzer.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211769 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/MiniBrowser/mac/BrowserWindowController.m
Tools/MiniBrowser/mac/ExtensionManagerWindowController.m
Tools/MiniBrowser/mac/SettingsController.m

index 515c90f..8cb33d1 100644 (file)
@@ -1,3 +1,20 @@
+2017-02-06  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Static Analyzer: Address some leaks in MiniBrowser
+        https://bugs.webkit.org/show_bug.cgi?id=167897
+
+        Reviewed by Alexey Proskuryakov.
+
+        * MiniBrowser/mac/BrowserWindowController.m:
+        (-[BrowserWindowController sharingService:transitionImageForShareItem:contentRect:]):
+        * MiniBrowser/mac/ExtensionManagerWindowController.m:
+        (-[ExtensionManagerWindowController add:]):
+        (-[ExtensionManagerWindowController remove:]):
+        * MiniBrowser/mac/SettingsController.m:
+        (-[SettingsController _populateMenu]):
+        (-[SettingsController togglePerWindowWebProcessesDisabled:]):
+        Address obvious leaks caught by the static analyzer.
+
 2017-02-06  Myles C. Maxfield  <mmaxfield@apple.com>
 
         Migrate ComplexTextController to use platform-independent types
index a334774..3273fe4 100644 (file)
@@ -262,7 +262,7 @@ static CGRect coreGraphicsScreenRectForAppKitScreenRect(NSRect rect)
     NSImage *image = [[NSImage alloc] initWithCGImage:imageRef size:NSZeroSize];
     CGImageRelease(imageRef);
 
-    return image;
+    return [image autorelease];
 }
 
 - (nullable NSWindow *)sharingService:(NSSharingService *)sharingService sourceWindowForShareItems:(NSArray *)items sharingContentScope:(NSSharingContentScope *)sharingContentScope
index fe9a626..a207d81 100644 (file)
 
             [mutableInstalledContentExtensions addObject:identifier];
             [defaults setObject:mutableInstalledContentExtensions forKey:@"InstalledContentExtensions"];
+            [mutableInstalledContentExtensions release];
 
             [arrayController addObject:identifier];
 
         NSMutableArray *installedContentExtensions = [[defaults arrayForKey:@"InstalledContentExtensions"] mutableCopy];
         [installedContentExtensions removeObject:identifierToRemove];
         [defaults setObject:installedContentExtensions forKey:@"InstalledContentExtensions"];
+        [installedContentExtensions release];
 
         [arrayController removeObjectAtArrangedObjectIndex:index];
         BrowserAppDelegate* appDelegate = (BrowserAppDelegate *)[[NSApplication sharedApplication] delegate];
index 51e0b44..acc9932 100644 (file)
@@ -187,6 +187,7 @@ typedef NS_ENUM(NSInteger, DebugOverylayMenuItemTag) {
 
     [_menu addItem:experimentalFeaturesSubmenuItem];
     [experimentalFeaturesSubmenuItem release];
+    [experimentalFeaturesMenu release];
 #endif // WK_API_ENABLED
 
     [self _addHeaderWithTitle:@"WebKit1-only Settings"];
@@ -322,7 +323,10 @@ typedef NS_ENUM(NSInteger, DebugOverylayMenuItemTag) {
     [alert addButtonWithTitle:@"Switch and Quit"];
     [alert addButtonWithTitle:@"Cancel"];
 
-    if ([alert runModal] != NSAlertFirstButtonReturn)
+    NSModalResponse response = [alert runModal];    
+    [alert release];
+
+    if (response != NSAlertFirstButtonReturn)
         return;
 
     [self _toggleBooleanDefault:PerWindowWebProcessesDisabledKey];