summaryrefslogtreecommitdiff
path: root/src/cnode
diff options
context:
space:
mode:
authorJohn Southworth <john.southworth@vyatta.com>2012-06-03 10:29:41 -0700
committerJohn Southworth <john.southworth@vyatta.com>2012-06-08 14:39:54 -0700
commita8b48e0dee8fcd9dbe602f8b09400d4082ca7d77 (patch)
treef3a5c67ed7ed393de0a548ce828c066dfcd89eca /src/cnode
parent3df95d3f999867e64d04604705f3d6f89fdad392 (diff)
downloadvyatta-cfg-a8b48e0dee8fcd9dbe602f8b09400d4082ca7d77.tar.gz
vyatta-cfg-a8b48e0dee8fcd9dbe602f8b09400d4082ca7d77.zip
Fix more load/commit memory leaks
This fixes some more of the memory leaks in load and commit. Some still exist in the legacy cli_new/cli_parse code. Since that code is supposed to be rewritten such that it interfaces with the rewritten commit code in a clean way, these will not be fixed right now.
Diffstat (limited to 'src/cnode')
-rw-r--r--src/cnode/cnode-util.hpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cnode/cnode-util.hpp b/src/cnode/cnode-util.hpp
index aeeeb08..1b0f042 100644
--- a/src/cnode/cnode-util.hpp
+++ b/src/cnode/cnode-util.hpp
@@ -27,7 +27,11 @@ public:
typedef typename nodes_vec_type::iterator nodes_iter_type;
TreeNode() : _parent(0) {}
- virtual ~TreeNode() {}
+ virtual ~TreeNode() {
+ for ( nodes_iter_type it = _child_nodes.begin(); it != _child_nodes.end(); ++it )
+ delete * it;
+ _child_nodes.clear();
+ }
const nodes_vec_type& getChildNodes() const { return _child_nodes; }
size_t numChildNodes() const {