...
| Code Block | ||||
|---|---|---|---|---|
| ||||
char *message; int message_type; /* initializeInitialize message and message_type */ if (message_type == value_1) { /* Process message type 1 */ free(message); message = NULL; } /* ...*/ if (message_type == value_2) { /* Process message type 2 */ free(message); message = NULL; } |
...
| CERT C++ Secure Coding Standard | MEM01-CPP. Store a valid value in pointers immediately after deallocation |
| ISO/IEC TR 24772:2013 | Dangling References to Stack Frames [DCM] Dangling Reference to Heap [XYK] Off-by-one Error [XZH] |
| MITRE CWE | CWE-416, Use after free CWE-415, Double free |
Bibliography
| [Seacord 2005a2013] | Chapter 4, "Dynamic Memory Management" |
| [Plakosh 2005] |
...