Skip to content

Commit 3af21cd

Browse files
Avoid leaks false positive in CoreBluetooth mock
1 parent c369f68 commit 3af21cd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/darwin/Framework/CHIPTests/TestHelpers/MTRMockCB.m

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
#import "MTRMockCB.h"
1818

19-
#import <CoreBluetooth/CoreBluetooth.h>
2019
#import <XCTest/XCTest.h>
2120
#import <objc/runtime.h>
2221
#import <os/log.h>
@@ -169,6 +168,8 @@ static void InterceptClassMethod(__strong os_block_t * inOutCleanup, Class cls,
169168
// inherited implementation; this is good enough for our purposes here.
170169
method_setImplementation(method, originalImp);
171170
imp_removeBlock(newImp); // otherwise the block might leak
171+
(void)block; // keep an obvious reference to avoid `leaks` false positives before cleanup
172+
172173
if (nextCleanup) {
173174
nextCleanup();
174175
}

0 commit comments

Comments
 (0)