I've encountered the following code in a book I'm reading. It is given as an example for free()'ing a linked list. I believe that there is a bug in the highlighted part -- a freed memory location is being accessed.
Am I right in thinking this, or have I misunderstood something?
Code:current = head; while (current != NULL) { free(current); current = current->next; }