In objetive-c template for initializer
-(id)init { if (self = [super init]) { // Initialization code here } return self; }
If the initializer does not work, it should return nil . This means that if your initializer fails, it must correctly release self to avoid leakage. Therefore, I think that you are safe if you follow the pattern.
-(id)init { if (self = [super init]) { if (myInitializationFunc() == ERR_FAIL) { [self release]; return nil; } } return self; }
source share