From: Ilho Kim Date: Fri, 25 Sep 2020 07:50:48 +0000 (+0900) Subject: Fix memory leak X-Git-Tag: accepted/tizen/6.0/unified/20201113.014551~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=790434f00ab0c54dfbaa34a4a6dd9195435c58a5;p=platform%2Fcore%2Fappfw%2Fwgt-backend.git Fix memory leak After using glob(), the glob_t should be freed using globfree() After using xmlReadFile(), the return value shoud be freed using xmlFreeDoc() Change-Id: I84a514e0849eb85ccf23834770c39d3d3220f635 Signed-off-by: Ilho Kim --- diff --git a/src/wgt/step/security/step_check_extension_privileges.cc b/src/wgt/step/security/step_check_extension_privileges.cc index affeb47..796022d 100755 --- a/src/wgt/step/security/step_check_extension_privileges.cc +++ b/src/wgt/step/security/step_check_extension_privileges.cc @@ -60,6 +60,7 @@ common_installer::Step::Status StepCheckExtensionPrivileges::process() { for (unsigned int i = 0; i < glob_result.gl_pathc; ++i) { xmlFiles.insert(glob_result.gl_pathv[i]); } + globfree(&glob_result); } GList* privileges = nullptr; BOOST_SCOPE_EXIT_ALL(privileges) { diff --git a/src/wgt/utils/extension_config_parser.cc b/src/wgt/utils/extension_config_parser.cc index 7a448a4..684c292 100644 --- a/src/wgt/utils/extension_config_parser.cc +++ b/src/wgt/utils/extension_config_parser.cc @@ -42,6 +42,7 @@ std::unique_ptr std::unique_ptr result(new parser::DictionaryValue); if (dv) result->Set(reinterpret_cast(root_node->name), dv.release()); + xmlFreeDoc(doc); return result; }