Fixed memory leak

This commit is contained in:
anschrammh 2019-05-08 23:04:18 +02:00
parent 27385ccab4
commit 3f7c5f369b

View File

@ -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;