1463
Common Consequences
Scope Impact Likelihood
Other Other
Potential Mitigations
Phase: Architecture and Design
Follow the resource's lifecycle from creation to release.
Demonstrative Examples
Example 1:
The following code shows a simple example of a double free vulnerability.
Example Language: C (Bad)
char* ptr = (char*)malloc (SIZE);
...
if (abrt) {
free(ptr);
}
...
free(ptr);
Double free vulnerabilities have two common (and sometimes overlapping) causes:
• Error conditions and other exceptional circumstances
• Confusion over which part of the program is responsible for freeing the memory
Although some double free vulnerabilities are not much more complicated than this example,
most are spread out across hundreds of lines of code or even different files. Programmers seem
particularly susceptible to freeing global variables more than once.
Observed Examples
Reference Description
CVE-2006-5051 Chain: Signal handler contains too much functionality (CWE-828), introducing
a race condition (CWE-362) that leads to a double free (CWE-415).
https://www.cve.org/CVERecord?id=CVE-2006-5051
MemberOf Relationships
This MemberOf relationships table shows additional CWE Catgeories and Views that reference this
weakness as a member. This information is often useful in understanding where a weakness fits
within the context of external information sources.
Nature Type ID Name Page
MemberOf 984 SFP Secondary Cluster: Life Cycle 888 2411
MemberOf 1162 SEI CERT C Coding Standard - Guidelines 08. Memory
Management (MEM)
1154 2458
MemberOf 1163 SEI CERT C Coding Standard - Guidelines 09. Input
Output (FIO)
1154 2459
MemberOf 1416 Comprehensive Categorization: Resource Lifecycle
Management
1400 2545
Taxonomy Mappings
Mapped Taxonomy Name Node ID Fit Mapped Node Name
CERT C Secure Coding FIO46-C CWE More
Abstract
Do not access a closed file
CWE Version 4.14
CWE-667: Improper Locking
CWE-667: Improper Locking