Versions Compared

Key

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

...

Code Block
for(p = head; p != NULL; p= p->next)
  free(p);

Compliant Solution 1

To correct this error, a reference to p->next is stored in q before freeing p.

...