Versions Compared

Key

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

According to the C standard [ISO/IEC 9899-2011], the behavior of a program that uses the value of a pointer that refers to space deallocated by a call to the free() or realloc() function is undefined. (See undefined behavior 168  of Annex J.)

Reading a pointer to deallocated memory is undefined because the pointer value is indeterminate and  and can have a trap representation. In the latter case, doing so may cause a hardware trap.

...