Please help me with this memory leak. In the leaks tool it shows a leak: NSCFString (32 bytes) in the library Foundation
Responsible Frame: NSPropertyListSerialization
. I am releasing the error but still a leak. What am I missing? Many thanks!
NSPropertyListFormat format;
NSString *anError = nil;
id plist;
plist = [NSPropertyListSerialization propertyListFromData:rawCourseArray mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&anError];
if (!plist){
[anError release];
}
NSArray *entries = (NSArray *)plist;
for (NSDictionary *entry in entries)
{
// DO SOMETHING
}
[anError release]
in your code; you don't own the reference toanError
.propertyListFromData:
will have autoreleased it before returning to your code. However, this is a double-free bug, not a leak. I don't see any leak in the code you posted. – Improper