Folks;

Alert - potential boneheaded-ness lies ahead - please be gentle.

I'll be the first to admit that I'm much happier in ObjC than C…

I thought I would try static analysis and see what turned up.
On the whole I must say I'm pleased but this one has me questioning my basic understanding

        if (![[NSFileManager defaultManager] fileExistsAtPath:thisPath]) {
                …
41      } else {
42              MDItemRef mdi = MDItemCreate( nil, (CFStringRef)thisPath );
43              if  ( mdi != nil )  {
44 CFDictionaryRef dictRef = MDItemCopyAttributes( mdi, MDItemCopyAttributeNames(mdi));
                        …
                        CFRelease(dictRef);
                } else {
                        … handle error
                }
        }

Static Analysis tells me I have a potential leak of object allocated on line 44 -- that's all.

My questions are:
1) Why is there not a warning for the object allocated on line 42 - mdi ?
2) Why is the CFRelease(dictRef) not sufficient?

Thank you for you patience!
Steve_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to