Fix memory leak 65/251265/2
authorJunghyun Yeon <jungh.yeon@samsung.com>
Tue, 12 Jan 2021 05:20:41 +0000 (14:20 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Thu, 14 Jan 2021 04:56:06 +0000 (04:56 +0000)
Related changes:
[app-installers] : https://review.tizen.org/gerrit/251120

Change-Id: Ie5d74662f6ed8a5f911bbc2bc90bd78c007b2cc3
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
src/unified/unified_installer_factory.cc
test/smoke_test/smoke_test_helper.cc
test/smoke_test/smoke_utils.cc

index 1a6fea6..bcccc2a 100644 (file)
@@ -111,12 +111,14 @@ std::unique_ptr<AppInstaller> UnifiedInstallerFactory::CreateInstaller(
   std::unique_ptr<ci::AppInstaller> installer;
   if (type == "tpk") {
     // should be fixed.
-    tpk::TpkAppQueryInterface* tpk_aqi = new tpk::TpkAppQueryInterface();
+    std::shared_ptr<tpk::TpkAppQueryInterface> tpk_aqi(
+        new tpk::TpkAppQueryInterface());
     pkgmgr->AddAppQueryInterface(idx, tpk_aqi);
     installer.reset(new tpk::TpkInstaller(pkgmgr));
   } else {
     // should be fixed
-    wgt::WgtAppQueryInterface* wgt_aqi = new wgt::WgtAppQueryInterface();
+    std::shared_ptr<wgt::WgtAppQueryInterface> wgt_aqi(
+        new wgt::WgtAppQueryInterface());
     pkgmgr->AddAppQueryInterface(idx, wgt_aqi);
     if (wgt_aqi->IsHybridApplication(pkgmgr->GetRequestInfo(idx),
             pkgmgr->GetUid())) {
index 7ec7f02..ba595af 100644 (file)
@@ -38,7 +38,8 @@ class CrashInstallerFactory : public ci::InstallerFactory {
     int n_pkgs = pkgmgr->GetRequestInfoCount();
     std::unique_ptr<ci::AppInstaller> installer;
     if (type == "tpk") {
-      tpk::TpkAppQueryInterface* tpk_aqi = new tpk::TpkAppQueryInterface();
+      std::shared_ptr<tpk::TpkAppQueryInterface> tpk_aqi(
+          new tpk::TpkAppQueryInterface());
       pkgmgr->AddAppQueryInterface(idx, tpk_aqi);
       installer.reset(
           idx + 1 == n_pkgs ?
@@ -47,7 +48,8 @@ class CrashInstallerFactory : public ci::InstallerFactory {
               new tpk::TpkInstaller(pkgmgr));
 
     } else {
-      wgt::WgtAppQueryInterface* wgt_aqi = new wgt::WgtAppQueryInterface();
+      std::shared_ptr<wgt::WgtAppQueryInterface> wgt_aqi(
+          new wgt::WgtAppQueryInterface());
       pkgmgr->AddAppQueryInterface(idx, wgt_aqi);
       installer.reset(
           idx + 1 == n_pkgs ?
@@ -68,12 +70,14 @@ class RemovePluginInstallerFactory : public ci::InstallerFactory {
         smoke_test::GetPkgType(pkgmgr->GetRequestInfo(idx), pkgmgr->GetUid());
     std::unique_ptr<ci::AppInstaller> installer;
     if (type == "tpk") {
-      tpk::TpkAppQueryInterface* tpk_aqi = new tpk::TpkAppQueryInterface();
+      std::shared_ptr<tpk::TpkAppQueryInterface> tpk_aqi(
+          new tpk::TpkAppQueryInterface());
       pkgmgr->AddAppQueryInterface(idx, tpk_aqi);
       installer.reset(
           new smoke_test::TpkInstallerWithoutPasrserPlugins(pkgmgr));
     } else {
-      wgt::WgtAppQueryInterface* wgt_aqi = new wgt::WgtAppQueryInterface();
+      std::shared_ptr<wgt::WgtAppQueryInterface> wgt_aqi(
+          new wgt::WgtAppQueryInterface());
       pkgmgr->AddAppQueryInterface(idx, wgt_aqi);
       if (wgt_aqi->IsHybridApplication(pkgmgr->GetRequestInfo(idx),
           pkgmgr->GetUid())) {
index 6e50629..c871d40 100644 (file)
@@ -80,11 +80,13 @@ UnifiedSmokeInstallerFactory::CreateInstaller(
 
   std::unique_ptr<ci::AppInstaller> installer;
   if (type == "tpk") {
-    tpk::TpkAppQueryInterface* tpk_aqi = new tpk::TpkAppQueryInterface();
+    std::shared_ptr<tpk::TpkAppQueryInterface> tpk_aqi(
+        new tpk::TpkAppQueryInterface());
     pkgmgr->AddAppQueryInterface(idx, tpk_aqi);
     installer.reset(new tpk::TpkInstaller(pkgmgr));
   } else {
-    wgt::WgtAppQueryInterface* wgt_aqi = new wgt::WgtAppQueryInterface();
+    std::shared_ptr<wgt::WgtAppQueryInterface> wgt_aqi(
+        new wgt::WgtAppQueryInterface());
     pkgmgr->AddAppQueryInterface(idx, wgt_aqi);
     if (wgt_aqi->IsHybridApplication(pkgmgr->GetRequestInfo(idx),
             pkgmgr->GetUid())) {
@@ -109,11 +111,13 @@ UnifiedSmokeInstallerFactory::CreateFailExpectedInstaller(
 
   std::unique_ptr<ci::AppInstaller> installer;
   if (type == "tpk") {
-    tpk::TpkAppQueryInterface* tpk_aqi = new tpk::TpkAppQueryInterface();
+    std::shared_ptr<tpk::TpkAppQueryInterface> tpk_aqi(
+        new tpk::TpkAppQueryInterface());
     pkgmgr->AddAppQueryInterface(idx, tpk_aqi);
     installer.reset(new smoke_test::FailExpectedTpkInstaller(pkgmgr, fail_at));
   } else {
-    wgt::WgtAppQueryInterface* wgt_aqi = new wgt::WgtAppQueryInterface();
+    std::shared_ptr<wgt::WgtAppQueryInterface> wgt_aqi(
+        new wgt::WgtAppQueryInterface());
     pkgmgr->AddAppQueryInterface(idx, wgt_aqi);
     if (wgt_aqi->IsHybridApplication(pkgmgr->GetRequestInfo(idx),
             pkgmgr->GetUid())) {