• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Static analyser grumbling
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Static analyser grumbling (From: Kevin Meaney <email@hidden>)

  • Prev by Date: Static analyser grumbling
  • Next by Date: NSWindow setMinSize: jumps up to current size instead
  • Previous by thread: Static analyser grumbling
  • Next by thread: Re: Static analyser grumbling
  • Index(es):
    • Date
    • Thread