Title: [249907] trunk/Source/WebKit
Revision
249907
Author
ddkil...@apple.com
Date
2019-09-16 11:29:49 -0700 (Mon, 16 Sep 2019)

Log Message

[WebAuthn] REGRESSION (r249059): Leak of WKMockNFTag objects and WKMockNFTag instance variables
<https://webkit.org/b/201813>

Reviewed by Darin Adler.

* UIProcess/WebAuthentication/Mock/MockNfcService.mm:
(-[WKMockNFTag dealloc]): Add method and release instance
variables to fix leaks.
(WebKit::MockNfcService::detectTags const): Use adoptNS() to fix
leaks of WKMockNFTag objects.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (249906 => 249907)


--- trunk/Source/WebKit/ChangeLog	2019-09-16 17:44:48 UTC (rev 249906)
+++ trunk/Source/WebKit/ChangeLog	2019-09-16 18:29:49 UTC (rev 249907)
@@ -1,5 +1,18 @@
 2019-09-16  David Kilzer  <ddkil...@apple.com>
 
+        [WebAuthn] REGRESSION (r249059): Leak of WKMockNFTag objects and WKMockNFTag instance variables
+        <https://webkit.org/b/201813>
+
+        Reviewed by Darin Adler.
+
+        * UIProcess/WebAuthentication/Mock/MockNfcService.mm:
+        (-[WKMockNFTag dealloc]): Add method and release instance
+        variables to fix leaks.
+        (WebKit::MockNfcService::detectTags const): Use adoptNS() to fix
+        leaks of WKMockNFTag objects.
+
+2019-09-16  David Kilzer  <ddkil...@apple.com>
+
         REGRESSION (r243113): Leak of multiple instance variable blocks when deallocating _WKAttributedStringNavigationDelegate
         <https://webkit.org/b/201812>
 

Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockNfcService.mm (249906 => 249907)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockNfcService.mm	2019-09-16 17:44:48 UTC (rev 249906)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockNfcService.mm	2019-09-16 18:29:49 UTC (rev 249907)
@@ -32,6 +32,7 @@
 #import "NfcConnection.h"
 #import <WebCore/FidoConstants.h>
 #import <wtf/BlockPtr.h>
+#import <wtf/RetainPtr.h>
 #import <wtf/RunLoop.h>
 #import <wtf/Vector.h>
 
@@ -72,6 +73,18 @@
     return self;
 }
 
+- (void)dealloc
+{
+    [_tagID release];
+    _tagID = nil;
+    [_AppData release];
+    _AppData = nil;
+    [_UID release];
+    _UID = nil;
+
+    [super dealloc];
+}
+
 - (NSString*)description
 {
     return nil;
@@ -187,12 +200,12 @@
     auto callback = makeBlockPtr([configuration = m_configuration] {
         auto tags = adoptNS([[NSMutableArray alloc] init]);
         if (configuration.nfc->error == MockNfc::Error::WrongTagType || configuration.nfc->multipleTags)
-            [tags addObject:[[WKMockNFTag alloc] initWithType:NFTagTypeUnknown]];
+            [tags addObject:adoptNS([[WKMockNFTag alloc] initWithType:NFTagTypeUnknown]).get()];
         else
-            [tags addObject:[[WKMockNFTag alloc] initWithType:NFTagTypeGeneric4A]];
+            [tags addObject:adoptNS([[WKMockNFTag alloc] initWithType:NFTagTypeGeneric4A]).get()];
 
         if (configuration.nfc->multipleTags)
-            [tags addObject:[[WKMockNFTag alloc] initWithType:NFTagTypeGeneric4A]];
+            [tags addObject:adoptNS([[WKMockNFTag alloc] initWithType:NFTagTypeGeneric4A]).get()];
 
         [globalNFReaderSessionDelegate readerSession:nil didDetectTags:tags.get()];
     });
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to