1
Vote

XMLGenerator doesn't retain XMLString

description

The initializers for XMLGenerator are autoreleasing the XMLString they create. This should lead to a crash eventually. Also, initWithString: is calling [super init] twice. Here are the corrected methods.
 
-(id)initDefaultAtomHeader{
if(self = [super init])
    XMLString = [[NSMutableString alloc] initWithFormat:@"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"];
return self;
}
 
-(id)initWithString:(NSString *)xmlstring
{
if(self = [super init])
{
    XMLString = [[NSMutableString alloc] initWithString:xmlstring];
}
return self;
}
 
 
-(void)dealloc{
[XMLString release];
[super dealloc];
}

comments

claudioc wrote Sep 7, 2010 at 6:33 PM

Thanks for reporting this issue.

This is a known issue and it will be fixed with the next release of the SDK (about 1 week away)

Thanks
Claudio