Date: Fri, 28 Apr 95 15:36:59 EDT From: John "E." Davis To: B DOT S DOT Runnacles AT soton DOT ac DOT uk, djgpp AT sun DOT soe DOT clarkson DOT edu Subject: Re: Yet more problems freeing memory >I think I've traced the leak to the linked list objects I use, can anyone spot >what is wrong here: > >private: >listnode *Current,*Root > >LinkedList::~LinkedList(void) >{ >for(Current = Root; Current!=NULL; Current=Current->next) > delete Current; >} I do not know that much about C++, but I do know C and you should write the above as: listnode *next; Current = Root; while (Current != NULL) { next = Current->next; delete Current; Current = next; } There is no guarantee that the next field of current has any meaning once Current is deleted. The above fragment gets it before Current is deleted. --John