EDStarRating icon indicating copy to clipboard operation
EDStarRating copied to clipboard

Static analyzer warning

Open cparnot opened this issue 10 years ago • 0 comments

The line where the warning appears:

https://github.com/erndev/EDStarRating/blob/master/EDStarRating/EDStarRating.m#L186

The warning is: "Incorrect decrement of the reference count of an object that is not owned at this point by the caller"

The colorSpace object is created on line 182:

    CGColorSpaceRef colorSpace = [[color colorSpace] CGColorSpace];

The method should return an autoreleased CF object, afaict. It should not be released, or it would be overreleased and it could lead to a crash. It might still work ok if color spaces are singletons and never released, which I suspect is probably the case (I don't think a new color space obejct is created every time a color is created).

In any case, removing the release call would get rid of the static analyzer warning, and as far as I can tell, things work perfectly well without it.

cparnot avatar Jun 26 '14 15:06 cparnot