From 9dfc039602273ff37d9bc0a4d15718fcadc8d43a Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Fri, 11 Oct 2024 09:59:23 +0200 Subject: [PATCH] [darwin-framework-tool] Add missing autoreleasepool before checking for leaks --- examples/darwin-framework-tool/debug/LeakChecker.mm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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