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-03 10:29:41 -0700
commit4610ade056855f0e03457857d0f704c6d5b689f2 (patch)
tree32e5e8afca43ac814d7d087fb7d1161340375fdd /src/cnode
parent6c4cf990bf4ea521f602a6d4e8ac4d51de461da9 (diff)
downloadvyatta-cfg-4610ade056855f0e03457857d0f704c6d5b689f2.tar.gz
vyatta-cfg-4610ade056855f0e03457857d0f704c6d5b689f2.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 {