I have a method that creates an returns an instance of a CoreGraphics
object - CGPathRef
.
When I run the app through Analyzer it complains that this method is leaking...it is , but it is deliberate. I do want to transfer the ownership to the caller and let them clean up.
What can I do to suppress this Analyzer warning?
- (CGPathRef) createSomePath:(CGPoint)center innerRadius:(CGFloat)innerRadius outerRadius:(CGFloat)outerRadius startAngle:(CGFloat)startAngle endAngle:(CGFloat)endAngle
{
CGMutablePathRef slicePath = CGPathCreateMutable();
....
return slicePath; <--- Analyzer points to this line as a potential leak.
}
Assume this should be possible as lots of frameworks return these objects requiring the caller to clean up...
Thanks in advance !
P.S. Am afraid that this question is not a dup nor does not have a proper answer anywhere else...the 3 answers highlighted at the top of this page are not proper/complete...only the answer provided here by Matthias Bauch i.e. "new" rule is truly the right answer to the question I raised :) THANKS!