Issue 31: Failed init results in memory leak
Status:  Duplicate
Owner: ----
Closed:  Sep 2008
Reported by jheising, Sep 25, 2008
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];




Sep 25, 2008
#1 jheising
Sorry about the multiple posts. Google was returning an error and I didn't know it 
was being submitted.
Sep 28, 2008
Project Member #2 jwight
Dupe.
Status: Duplicate