I create a CXMLDocument with standard syntax:
CXMLDocument* xmlDoc = [[CXMLDocument alloc]
initWithXMLString:@"BadXMLString" options:1 << 10 error:&error];
If the XML String is bad, initWithXMLString returns a NULL object reference
and xmlDoc is now equal to NULL. Now that xmlDoc is NULL there is no way to
[xmlDoc release] the original [CXMLDocument alloc] and it results in a
memory leak.
The only way to get around this is to create two objects:
CXMLDocument* xmlDocAlloc = [CXMLDocument alloc];
CXMLDocument* xmlDoc = [xmlDocAlloc initWithXMLString: ....... ];
if(xmlDoc == nil)
[xmlDocAlloc release];