Versions Compared

Key

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

...

Always check that malloc() returns a non-null pointer, as per void MEM32ERR33-C. Detect and handle memory allocation standard library errors.

It is important to retain any pointer value returned by malloc() so that the referenced memory may eventually be deallocated. One possible way to preserve such a value is to use a constant pointer:

...