From f797adb61ee37441f847c695a5a4786c8848492f Mon Sep 17 00:00:00 2001 From: Hyunwoo Kim Date: Mon, 15 Jul 2013 22:29:11 +0900 Subject: [PATCH] Fix memory leaks Change-Id: Id98dad64da604932776142f6a04e8d8565d9e443 Signed-off-by: Hyunwoo Kim --- ace/engine/TreeNode.cpp | 1 + ace/engine/parser.cpp | 4 ++++ packaging/wrt-security.spec | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ace/engine/TreeNode.cpp b/ace/engine/TreeNode.cpp index 039ada6..0171f4d 100644 --- a/ace/engine/TreeNode.cpp +++ b/ace/engine/TreeNode.cpp @@ -21,6 +21,7 @@ //release resources should be called when we want to destroy the whole tree TreeNode::~TreeNode() { + delete element; } //TODO release resources is releaseTheSubtree and delete the element diff --git a/ace/engine/parser.cpp b/ace/engine/parser.cpp index 9ca4daf..76491f1 100644 --- a/ace/engine/parser.cpp +++ b/ace/engine/parser.cpp @@ -139,6 +139,7 @@ TreeNode* Parser::parse(const std::string& filename, const std::string& schema) if (!xmlValidContext) { LogError("Couldn't create validation context!"); + xmlSchemaFree(xmlSchema); return root; } @@ -166,6 +167,8 @@ TreeNode* Parser::parse(const std::string& filename, const std::string& schema) schemaValidContext.get(), xmlDocument) == 0 ? true : false); + xmlSchemaFree(xmlSchema); + if (!result) { LogError("Couldn't validate policy file: " << filename << " against xml schema: " << schema); @@ -433,6 +436,7 @@ void Parser::handleCondition(xmlTextReaderPtr reader) condition->setParent(currentCondition); currentCondition = condition; + xmlFree(combine); //TODO what about empty condition tag? } diff --git a/packaging/wrt-security.spec b/packaging/wrt-security.spec index 5eb110d..1accebf 100644 --- a/packaging/wrt-security.spec +++ b/packaging/wrt-security.spec @@ -2,7 +2,7 @@ Name: wrt-security Summary: Wrt security daemon. Version: 0.0.62 -Release: 3 +Release: 4 Group: TO_BE/FILLED_IN License: Apache License, Version 2.0 URL: N/A -- 2.7.4