diff --git a/examples/darwin-framework-tool/debug/LeakChecker.mm b/examples/darwin-framework-tool/debug/LeakChecker.mm index 72a441420abc22..25f4f1eadcfd3e 100644 --- a/examples/darwin-framework-tool/debug/LeakChecker.mm +++ b/examples/darwin-framework-tool/debug/LeakChecker.mm @@ -60,9 +60,11 @@ - (BOOL)hasMemoryLeaks int ConditionalLeaksCheck(int exitCode) { #ifdef DFT_ENABLE_LEAK_CHECKING - auto * leakChecker = [[LeakChecker alloc] init]; - if ([leakChecker hasMemoryLeaks]) { - return EXIT_FAILURE; + @autoreleasepool { + auto * leakChecker = [[LeakChecker alloc] init]; + if ([leakChecker hasMemoryLeaks]) { + return EXIT_FAILURE; + } } #endif // DFT_ENABLE_LEAK_CHECKING