Fixed memory leak
This commit is contained in:
parent
27385ccab4
commit
3f7c5f369b
@ -43,9 +43,11 @@ public:
|
||||
if(isQueueEmpty(_head->_next))return NULL;
|
||||
|
||||
T *refToReturn = _head->_next->_value;
|
||||
|
||||
Queue *toDelete(_head->_next);
|
||||
_head->_next = _head->_next->_next;
|
||||
|
||||
delete toDelete;
|
||||
|
||||
return refToReturn;
|
||||
}
|
||||
T remove()
|
||||
@ -74,6 +76,7 @@ public:
|
||||
toDelete = cursor;
|
||||
cursor = cursor->_next;
|
||||
|
||||
delete toDelete->_value;
|
||||
delete toDelete;
|
||||
}
|
||||
_head = this;
|
||||
|
Loading…
Reference in New Issue
Block a user