Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone - Why didn't the Static Analyzer pick this up?

@property(nonatomic, retain) NSMutableArray* playerList;

...

team.playerList = [[NSMutableArray alloc] initWithArray:self.playerList];

This is a memory leak right?

So why couldn't the static analysier pick this up?

like image 596
Robert Avatar asked Mar 09 '11 11:03

Robert


People also ask

How do I run static analyzer in Xcode?

Just go to Product and choose Analyze, or use the keyboard shortcut Command-Shift-B. You can see the analyzer running in the status bar of Xcode.

What does static analysis tools detect?

Definition. Static application security testing (SAST), or static analysis, is a testing methodology that analyzes source code to find security vulnerabilities that make your organization's applications susceptible to attack. SAST scans an application before the code is compiled. It's also known as white box testing.

Does Xcode 13 support iOS 15?

Xcode 13 includes SDKs for iOS 15, iPadOS 15, tvOS 15, watchOS 8, and macOS Big Sur 11.3. The Xcode 13 release supports on-device debugging for iOS 9 and later, tvOS 9 and later, and watchOS 2 and later.


1 Answers

Yes, that's a memory leak; you need to either autorelease that array or manually release it after setting the property. I'm not sure why the static analyzer missed it—you might consider filing a bug against the developer tools.

like image 101
Noah Witherspoon Avatar answered Oct 01 '22 02:10

Noah Witherspoon