This may seem like a silly question, but the reason I'm asking for is because I have this destructor:
list::~list()
{
for (node* next = headByName->nextByName; headByName; headByName = next)
{
delete headByName;
}
}
and valgrind still says i have a memory leak. Therefore, I assume that my real question is: is my destructor corrupted incorrectly, or is it just bad to destroy a list by going through its head with a node?
source
share