I write a function such as follows to create a CGPath:
+(CGPathRef)CGPathCreateRoundrect:(CGRect)rect radius:(CGFloat)radius {
CGMutablePathRef path = CGPathCreateMutable();
......
CGPathCloseSubpath(path);
return path;
}
The analyzer says the first line of code create a object that is potentially leaked. But i do want to create a new object in this function and transfer ownership to the caller. And the function name contains the key word “Create”. Is this a bug of “Analyzer”?
This is happening because according to compiler understanding a
+()method will always return autoreleased variable which is not in your case.