...
To eliminate double-free vulnerabilities, it is necessary to guarantee that dynamic memory is freed exactly once. Programmers should be wary when freeing memory in a loop or conditional statement; if coded incorrectly, these constructs can lead to double-free vulnerabilities. It is also a common error to misuse the realloc() function in a manner that results in double-free vulnerabilities. (See MEM04-C. Do not perform Beware of zero-length allocations.)
Rule | Severity | Likelihood | Remediation Cost | Priority | Level |
|---|---|---|---|---|---|
MEM30-C | High | Likely | Medium | P18 | L1 |
...
| CERT C Secure Coding Standard | MEM01-C. Store a new value in pointers immediately after free() |
| CERT C++ Secure Coding Standard | MEM30-CPP. Do not access freed memory |
| ISO/IEC TR 24772:2013 | Dangling References to Stack Frames [DCM] Dangling Reference to Heap [XYK] |
| ISO/IEC TS 17961 | Accessing freed memory [accfree] |
| MISRA C:2012 | Rule 18.6 (required) |
| MITRE CWE |
...