Versions Compared

Key

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

Accessing memory once it is freed may corrupt the data structures used to manage the heap. When a memory is reallocaed by calling {{free()}, the underlying structures that manage the block of memory to be freed manipulate that chunk to place back in to the pool of memory available for allocation. References to memory that has been deallocated are referred to as dangling pointers. Accessing a dangling pointer can lead to security vulnerabilities.

When memory is freed its contents may remain intact and accessible. This is because it is at the memory manager's discretion when to reallocate or recycle the freed chunk. The data at the freed location may appear to be valid. However, this can change unexpectedly leading to unintended program behavior. As a result, it is necessary to guarantee that memory is not written to or read from once it is freed.

...