diff options
author | Adrian Kummerländer | 2012-04-15 00:26:12 +0200 |
---|---|---|
committer | Adrian Kummerländer | 2012-04-15 00:26:12 +0200 |
commit | 4daed5ebe3e8eae184a96055974ac15a3c55507f (patch) | |
tree | 900920a59780915d8b8eb75eccdf6afd45c680e0 /tree.cpp | |
parent | de97f27c7aa3c74a40d5ba7ce9477d4bbdefbe8e (diff) | |
download | SimpleParser-4daed5ebe3e8eae184a96055974ac15a3c55507f.tar SimpleParser-4daed5ebe3e8eae184a96055974ac15a3c55507f.tar.gz SimpleParser-4daed5ebe3e8eae184a96055974ac15a3c55507f.tar.bz2 SimpleParser-4daed5ebe3e8eae184a96055974ac15a3c55507f.tar.lz SimpleParser-4daed5ebe3e8eae184a96055974ac15a3c55507f.tar.xz SimpleParser-4daed5ebe3e8eae184a96055974ac15a3c55507f.tar.zst SimpleParser-4daed5ebe3e8eae184a96055974ac15a3c55507f.zip |
Removed all memory leaks detected by valgrind
Diffstat (limited to 'tree.cpp')
-rw-r--r-- | tree.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -69,11 +69,20 @@ Tree::Tree() this->nodeCollection = new vector<Node*>(); } +Tree::~Tree() +{ + for ( vector<Node*>::iterator it = this->nodeCollection->begin(); it != this->nodeCollection->end(); it++ ) + { + delete *it; + } + + delete this->nodeCollection; +} + Node* Tree::addOperand(Node **place, double value) { OperandNode *newNode = new OperandNode(); - newNode = new OperandNode(); newNode->value = value; this->nodeCollection->push_back( newNode ); @@ -89,7 +98,6 @@ Node* Tree::addOperator(Node **place, char oper) { OperatorNode *newNode = new OperatorNode(); - newNode = new OperatorNode(); newNode->function = oper; this->nodeCollection->push_back( newNode ); |