I think the problem here is that your delete function gets rid of the associated node data, so this happens:
- Program decides to delete s.
- Program deletes s and its associated node n.
- Program tries to get the next member of n, but can't because that node has been deleted and can no longer be assumed to hold valid data.
How I would solve this is by moving the line n=n->next; to immediately after the program extracts the element from n, so that n will always be valid when you extract the next member from it.