Fix memory leak 63/244863/3
authorIlho Kim <ilho159.kim@samsung.com>
Fri, 25 Sep 2020 07:50:48 +0000 (16:50 +0900)
committerIlho Kim <ilho159.kim@samsung.com>
Fri, 25 Sep 2020 09:50:57 +0000 (18:50 +0900)
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 <ilho159.kim@samsung.com>
src/wgt/step/security/step_check_extension_privileges.cc
src/wgt/utils/extension_config_parser.cc

index affeb47..796022d 100755 (executable)
@@ -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) {
index 7a448a4..684c292 100644 (file)
@@ -42,6 +42,7 @@ std::unique_ptr<parser::DictionaryValue>
   std::unique_ptr<parser::DictionaryValue> result(new parser::DictionaryValue);
   if (dv)
     result->Set(reinterpret_cast<const char*>(root_node->name), dv.release());
+  xmlFreeDoc(doc);
   return result;
 }