Memory leak when I add last a node to a doubly linked list C++ -


i facing memory leak when add last node doubly linked list. function is:

void addlast(const char* word){ // homework , parameter must const char* std::string c2 = word; // nodes std::string node *aux = new node(c2); if (tail == null) { head = tail = aux; }  else { tail->next = aux; aux->prev = tail; tail = aux; } } 

my strct node following:

struct node { std::string value; node *next, *prev; node (std::string value) { this->value = value; next = prev = null; } node () { next = prev = null; } } 

i mention fact if try delete aux in function addlast face seg fault. problem>


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -