Free requests after processing them in cmd line tool 74/116974/4
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Thu, 2 Mar 2017 07:24:07 +0000 (08:24 +0100)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Thu, 16 Mar 2017 13:03:47 +0000 (06:03 -0700)
App installation and user management requests were not freed after their
processing is finished in security-manager-cmd. Pointers wrapped in
std::unique_ptr.

Change-Id: I689833dea78ccedb5aaac9267d3c0a06895f0568

src/cmd/security-manager-cmd.cpp

index 0ed8bb0..c2c12c5 100644 (file)
@@ -33,6 +33,7 @@
 #include <dpl/singleton.h>
 #include <protocols.h>
 #include <security-manager.h>
+#include <utils.h>
 
 #include <boost/program_options.hpp>
 namespace po = boost::program_options;
@@ -357,6 +358,7 @@ int main(int argc, char *argv[])
             LogDebug("Install command.");
             if (security_manager_app_inst_req_new(&req) != SECURITY_MANAGER_SUCCESS)
                 return EXIT_FAILURE;
+            auto req_ptr = makeUnique(req, security_manager_app_inst_req_free);
             parseInstallOptions(argc, argv, *req, vm);
             return installApp(*req);
         } else if (vm.count("manage-users")) {
@@ -365,6 +367,8 @@ int main(int argc, char *argv[])
             LogDebug("Manage users command.");
             if (security_manager_user_req_new(&req) != SECURITY_MANAGER_SUCCESS)
                 return EXIT_FAILURE;
+            auto req_ptr = makeUnique(req, security_manager_user_req_free);
+
             parseUserOptions(argc, argv, *req, vm);
             return manageUserOperation(*req, operation);
         } else {