Hi every1 below is my code in which I’m getting memory leaks.
I’m really new to handling memory leak so please be kind to me even if its a simple bug.
-(void) parseActivityData:(NSMutableData*) data parseError:(NSError **)error
{
NSXMLParser* parser = [[NSXMLParser alloc] initWithData:data];
[parser setDelegate:self];
[parser setShouldProcessNamespaces:NO];
[parser setShouldReportNamespacePrefixes:NO];
[parser setShouldResolveExternalEntities:NO];
[parser parse];
NSError *parseError = [parser parserError];
if (parseError && error) {
*error = parseError;
}
[*error retain];
[parser release];
}
for this code I’m getting this memory leak issues one is “Method accepting NSError should have a non-void return value to indicate whether or not an error occurred” and the other is DeDereference of null pointer(loaded from variable ‘error’).
Thanks
Simply do what’s requested. Return a BOOL instead of void that is set to NO when you actually use the error param. Also do not
[*error retain];.