Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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 StandardMEM01-C. Store a new value in pointers immediately after free()
CERT C++ Secure Coding StandardMEM30-CPP. Do not access freed memory
ISO/IEC TR 24772:2013Dangling References to Stack Frames [DCM]
Dangling Reference to Heap [XYK]
ISO/IEC TS 17961

Accessing freed memory [accfree]
Freeing memory multiple times [dblfree]

MISRA C:2012Rule 18.6 (required)
MITRE CWE

CWE-415, Double free
CWE-416, Use after free

...