Re: Static analyser grumbling
Re: Static analyser grumbling
- Subject: Re: Static analyser grumbling
- From: Robert Martin <email@hidden>
- Date: Fri, 23 Aug 2013 08:32:31 -0400
If the context is created, and the init succeeds and returns a valid self, then you are leaking the context. Get rid of the 'else', since it causes the code to skip over the release.
On Aug 23, 2013, at 7:27 AM, Kevin Meaney <email@hidden> wrote:
> Hi,
>
> I'm using ARC and using Mavdacted and DP5 but I don't think this is related to anything under NDA. The static analyzer is complaining about the following:
>
> -(instancetype)initWithPreset:(NSString *)preset size:(CGPoint)size
> {
> CGContextRef context = CreateCGBitmapContextFromPresetSize(preset, size);
> if (!context)
> self = NULL;
>
> if (self)
> self = [super initWithCGContent:context
> baseObjectType:MMCGBitmapContextKey];
> if (self)
> _preset = preset;
> else
> {
> if (context)
> CGContextRelease(context);
> }
> return self;
> }
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden