dealloc does not call the superclass implementation
ID |
objectivec.correctness.dealloc_missing_super |
Severity |
low |
Remediation Complexity |
trivial |
Remediation Risk |
low |
Remediation Effort |
low |
Resource |
Resource Management |
Language |
Objective-C |
Description
Under manual reference counting dealloc must end with [super dealloc], otherwise the superclass never releases its own ivars and the object leaks. Add the super call as the last statement.
Rationale
Under manual reference counting dealloc must end with [super dealloc], otherwise the superclass never releases its own ivars and the object leaks. Add the super call as the last statement.
The following code illustrates the pattern detected by this rule:
@implementation Leaky
// FLAGGED: dealloc does not call the superclass implementation
- (void)dealloc {
[self.observer release];
}
@end