From 93e9e5e6701ce6427e120cdcf335a5d7c7ac0d0c Mon Sep 17 00:00:00 2001 From: "simon.fraser@apple.com" Date: Fri, 2 May 2014 18:46:53 +0000 Subject: [PATCH] Fix several memory leaks found by code inspection https://bugs.webkit.org/show_bug.cgi?id=132472 Reviewed by Geoffrey Garen. Fix memory leaks. * TestWebKitAPI/Tests/mac/WillSendSubmitEvent.mm: (TestWebKitAPI::TEST): * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: (WTR::InjectedBundlePage::willSendRequestForFrame): * WebKitTestRunner/mac/PlatformWebViewMac.mm: (WTR::PlatformWebView::changeWindowScaleIfNeeded): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@168177 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Tools/ChangeLog | 16 ++++++++++++++++ Tools/TestWebKitAPI/Tests/mac/WillSendSubmitEvent.mm | 2 +- .../InjectedBundle/InjectedBundlePage.cpp | 4 ++-- Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm | 2 +- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Tools/ChangeLog b/Tools/ChangeLog index f4ea390..50cc0ad 100644 --- a/Tools/ChangeLog +++ b/Tools/ChangeLog @@ -1,3 +1,19 @@ +2014-05-02 Simon Fraser + + Fix several memory leaks found by code inspection + https://bugs.webkit.org/show_bug.cgi?id=132472 + + Reviewed by Geoffrey Garen. + + Fix memory leaks. + + * TestWebKitAPI/Tests/mac/WillSendSubmitEvent.mm: + (TestWebKitAPI::TEST): + * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: + (WTR::InjectedBundlePage::willSendRequestForFrame): + * WebKitTestRunner/mac/PlatformWebViewMac.mm: + (WTR::PlatformWebView::changeWindowScaleIfNeeded): + 2014-05-02 Filip Pizlo DFGAbstractInterpreter should not claim Int52 arithmetic creates Int52s diff --git a/Tools/TestWebKitAPI/Tests/mac/WillSendSubmitEvent.mm b/Tools/TestWebKitAPI/Tests/mac/WillSendSubmitEvent.mm index 1654f9c..a3b058c 100644 --- a/Tools/TestWebKitAPI/Tests/mac/WillSendSubmitEvent.mm +++ b/Tools/TestWebKitAPI/Tests/mac/WillSendSubmitEvent.mm @@ -62,7 +62,7 @@ TEST(WebKit1, WillSendSubmitEvent) @autoreleasepool { RetainPtr webView = adoptNS([[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]); - RetainPtr formDelegate = [[FormDelegate alloc] init]; + RetainPtr formDelegate = adoptNS([[FormDelegate alloc] init]); [webView _setFormDelegate:formDelegate.get()]; [[webView.get() mainFrame] loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"auto-submitting-form" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]]; diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp index 21d3477..b44c410 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp +++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp @@ -1086,8 +1086,8 @@ WKURLRequestRef InjectedBundlePage::willSendRequestForFrame(WKBundlePageRef page if (!mainFrameURL || WKStringIsEqualToUTF8CString(adoptWK(WKURLCopyString(mainFrameURL.get())).get(), "about:blank")) mainFrameURL = adoptWK(WKBundleFrameCopyProvisionalURL(mainFrame)); - WKRetainPtr mainFrameHost = WKURLCopyHostName(mainFrameURL.get()); - WKRetainPtr mainFrameScheme = WKURLCopyScheme(mainFrameURL.get()); + WKRetainPtr mainFrameHost = adoptWK(WKURLCopyHostName(mainFrameURL.get())); + WKRetainPtr mainFrameScheme = adoptWK(WKURLCopyScheme(mainFrameURL.get())); mainFrameIsExternal = isHTTPOrHTTPSScheme(mainFrameScheme.get()) && !isLocalHost(mainFrameHost.get()); } if (!mainFrameIsExternal) { diff --git a/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm b/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm index 505fb29..5755b33 100644 --- a/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm +++ b/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm @@ -254,7 +254,7 @@ void PlatformWebView::changeWindowScaleIfNeeded(float newScale) // Instead of re-constructing the current window, let's fake resize it to ensure that the scale change gets picked up. forceWindowFramesChanged(); // Changing the scaling factor on the window does not trigger NSWindowDidChangeBackingPropertiesNotification. We need to send the notification manually. - RetainPtr notificationUserInfo = [[NSMutableDictionary alloc] initWithCapacity:1]; + RetainPtr notificationUserInfo = adoptNS([[NSMutableDictionary alloc] initWithCapacity:1]); [notificationUserInfo setObject:[NSNumber numberWithDouble:currentScale] forKey:NSBackingPropertyOldScaleFactorKey]; [[NSNotificationCenter defaultCenter] postNotificationName:NSWindowDidChangeBackingPropertiesNotification object:m_window userInfo:notificationUserInfo.get()]; } -- 1.8.3.1