So i called my Linked list destructor

~LinkedList() { 
	ListNode *current = head;
	ListNode *nextnode;
	while(current!=NULL){
		nextnode=current->next;
		delete current;
		current=nextnode;
     
	}

and i get.an error...._BLOCK_TYPE_IS_VALID(pHead->nBlockuse)
for some reason it doesn't like the "delete current"...I could use some help...thanks.

The problem is elsewhere in your code.

> and i get.an error...._BLOCK_TYPE_IS_VALID(pHead->nBlockuse)
These only appear only when you try to allocate or free memory. If you damage the memory pool, you don't get any error at the point the damage occurs, only (possibly) at some later alloc/free.

Eg.

char *p = new[10];
// lots of code
strcpy( p, "this string is longer than 10 chars");  // this is the real problem
// lots of code
delete [] p;  // this is where you MAY get an error (and the code you've posted)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.