NSFileManager reads from invalid memory
NSFileManager reads from invalid memory
- Subject: NSFileManager reads from invalid memory
- From: Tim Murison <email@hidden>
- Date: Fri, 27 Feb 2009 13:57:25 -0500
- Thread-topic: NSFileManager reads from invalid memory
Hi,
I noticed an issue in my code related to NSFileManager. When running my
program with gmalloc, I got a seg fault. I traced the cause back to
NSFileManager and wrote a simple reproducible program to illustrate the
issue. Can one of the gurus here point out a flaw, or is this a real bug?
#import <Cocoa/Cocoa.h>
int main(int argc, char **argv)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSFileManager *manager = [NSFileManager defaultManager];
NSString *path = @"/Applications";
NSDirectoryEnumerator *enumerator = [manager enumeratorAtPath:path];
for (id fileName in enumerator) {
NSAutoreleasePool *loopPool = [[NSAutoreleasePool alloc]
init];
NSString *file = [path
stringByAppendingPathComponent:fileName];
NSDictionary *attrs = [manager fileAttributesAtPath:file
traverseLink:YES];
[loopPool drain];
}
[pool drain];
return 0;
}
Cheers,
-Tim
***********************************************************************
This e-mail and its attachments are confidential, legally privileged, may be subject to copyright and sent solely for the attention of the addressee(s).
Any unauthorized use or disclosure is prohibited. Statements and opinions expressed in this e-mail may not represent those of Radialpoint.
Le contenu de ce courriel est confidentiel, privilégié et peut être soumis à des droits d'auteur. Il est envoyé à l'intention exclusive de son ou de ses
destinataires. Il est interdit de l'utiliser ou de le divulguer sans autorisation. Les opinions exprimées dans le présent courriel peuvent diverger de celles de Radialpoint.
_______________________________________________
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