summaryrefslogtreecommitdiff
path: root/src/cstore
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/cstore
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/cstore')
-rw-r--r--src/cstore/cstore.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/cstore/cstore.cpp b/src/cstore/cstore.cpp
index aacd15a..cc8a029 100644
--- a/src/cstore/cstore.cpp
+++ b/src/cstore/cstore.cpp
@@ -1827,6 +1827,7 @@ Cstore::loadFile(const char *filename)
// get the config tree from the file
CfgNode *froot = cparse::parse_file(fin, *this);
+ fclose(fin);
if (!froot) {
output_user("Failed to parse specified config file\n");
return false;
@@ -1842,6 +1843,7 @@ Cstore::loadFile(const char *filename)
vector<Cpath> com_list;
get_cmds_diff(aroot, *froot, del_list, set_list, com_list);
+ delete froot;
// "apply" the changes to the working config
for (size_t i = 0; i < del_list.size(); i++) {
if (!deleteCfgPath(del_list[i])) {