CWE
Home > CWE List > CWE- Individual Dictionary Definition (1.1)  
Search by ID:

CWE-568: finalize() Method Without super.finalize()

Individual Definition in a New Window
finalize() Method Without super.finalize()
Status: Draft
Weakness ID: 568 (Weakness Variant)
Description
Summary

The software contains a finalize() method that does not call super.finalize().

Potential Mitigations

Call the super.finalize() method.

Use static analysis tools to spot such issues in your code.

Demonstrative Examples

The following method omits the call to super.finalize().

Java Example:
protected void finalize() {
discardNative();
}
Other Notes

The Java Language Specification states that it is a good practice for a finalize() method to call super.finalize()

Relationships
NatureTypeIDNameView(s) this relationship pertains toView(s)
ChildOfCategoryCategory399Resource Management Errors
Development Concepts (primary)699
ChildOfWeakness ClassWeakness ClassWeakness Class573Failure to Follow Specification
Research Concepts1000
ChildOfWeakness BaseWeakness BaseWeakness Base404Improper Resource Shutdown or Release
Research Concepts (primary)1000
Applicable Platforms
Languages
Java
Time of Introduction
* Implementation
Content History
Modifications
Eric Dalci. Cigital. 2008-07-01. (External)
updated Potential_Mitigations, Time_of_Introduction
CWE Content Team. MITRE. 2008-09-08. (Internal)
updated Relationships, Other_Notes
Previous Entry Names
* Erroneous Finalize Method (changed 2008-04-11)
Page Last Updated: November 24, 2008