Fix memory leak issue. (Checked with valgrind)
authorSeungWon Lee <lsw2000.lee@samsung.com>
Thu, 18 Apr 2013 10:52:28 +0000 (19:52 +0900)
committerSeungWon Lee <lsw2000.lee@samsung.com>
Thu, 18 Apr 2013 10:52:28 +0000 (19:52 +0900)
Change-Id: I3a3930fff284e5faa3dc9d07e496f02569497ce0
Signed-off-by: SeungWon Lee <lsw2000.lee@samsung.com>
src/app/FApp_AppSettingImpl.cpp

index 4649cc2..2b09b5d 100644 (file)
@@ -165,11 +165,10 @@ _AppSettingImpl::_MutiInstanceManager::GetInstanceByAppId(const AppId& appId)
        SysTryReturn(NID_APP, pPkgMgrImpl != null, null, E_SYSTEM,
                                 "[%s] A system error has been occurred. failed to get _PackageMaangerImpl.", GetErrorMessage(E_SYSTEM));
 
-       PackageInfo* pPackageInfo = null;
-       pPackageInfo = pPkgMgrImpl->GetPackageInfoN(packageId); // !E_SUCCESS for DB fail and query fail
+       std::unique_ptr<PackageInfo> pPackageInfo(pPkgMgrImpl->GetPackageInfoN(packageId));     // !E_SUCCESS for DB fail and query fail
        SysTryReturn(NID_APP, pPackageInfo != null, null, E_APP_NOT_INSTALLED, "[%s] Propagating.", GetErrorMessage(E_APP_NOT_INSTALLED));
 
-       const _PackageInfoImpl* pPkgInfoImpl = _PackageInfoImpl::GetInstance(pPackageInfo);
+       const _PackageInfoImpl* pPkgInfoImpl = _PackageInfoImpl::GetInstance(pPackageInfo.get());
        SysTryReturn(NID_APP, pPkgInfoImpl != null, null, E_SYSTEM,
                                 "[%s] A system error has been occurred. failed to get _PackageInfoImpl.", GetErrorMessage(E_SYSTEM));
 
@@ -200,7 +199,6 @@ _AppSettingImpl::_MutiInstanceManager::GetInstanceByAppId(const AppId& appId)
 
 CATCH:
        delete pAppSettingInstance;
-       delete pPackageInfo;
        return null;
 }