iPhone, confusing memory leak.
- by fuzzygoat
Can anyone tell me what I am doing wrong with the bottom section of code. I was sure it was fine but "Leaks" says it is leaking which quickly changing it o the top version stops, just not sure as to why the bottom variation fails?
// Leaks says this is OK
if([elementName isEqualToString:@"rotData-requested"]) {
int myInt = [[self elementValue] intValue];
NSNumber *valueAsNumber = [NSNumber numberWithInt:myInt];
[self setRotData:valueAsNumber];
return;
}
.
// Leaks says this LEAKS
if([elementName isEqualToString:@"rotData-requested"]) {
NSNumber *valueAsNumber = [NSNumber numberWithInt:[[self elementValue] intValue]];
[self setRotData:valueAsNumber];
return;
}
any help would be appreciated.
gary