[[UIImage alloc] initWithContentsOfFile:path]
return nil when the method can't initialize the image. Then next code is not releasing the allocated UIImage, as image is nil in the [image release]
line:
UIImage* image = [[UIImage alloc] initWithContentsOfFile:path];
if(image)
{
....
}
//Here image is nil and not releases allocated UIImage.
[image release];
Is this really a memory leak?
if init returns nil, how must release the object? if I do UIImage* image = [[UIImage alloc] initWithContentsOfFile:path];
and image is nil because init fails, [image release] is the same as [nil release]. Ok there's not an error, but is not releasing anything.