NSData dataWithBytes:NoCopy:length free()'s the data (bug)
NSData dataWithBytes:NoCopy:length free()'s the data (bug)
- Subject: NSData dataWithBytes:NoCopy:length free()'s the data (bug)
- From: Allan Odgaard <email@hidden>
- Date: Fri, 1 Feb 2002 03:21:26 +0100
Hi there, I'm new to this list and MacOS in general, so I don't know if
this is where I report bugs. If not then where do I report them?
If I add this code to my application:
char bytes[] = { 1, 2, 3, 4 };
NSData *data = [NSData dataWithBytesNoCopy:bytes length:sizeof(bytes)];
Then the console reports the following error:
*** malloc[16103]: Deallocation of a pointer not malloced: 0xbffffa48;
This could be a double free(), or free() called with the middle of an
allocated block; Try setting environment variable MallocHelp to see
tools to help debug
On another subject, if I create an NSURL object where the URL string
contain [ or ], then the result is nil when I try to fetch data from
this URL. It works if I escape the characters ([ and ]), but I don't
think this should be necessary.