!143 解决轻鸿蒙包管理内存泄露问题

Merge pull request !143 from wangdengjia/master
This commit is contained in:
openharmony_ci
2022-03-20 13:45:07 +00:00
committed by Gitee
@@ -93,10 +93,12 @@ bool GtManagerService::Install(const char *hapPath, const InstallParam *installP
// create new bundleInstallMsg
bundleInstallMsg_ = reinterpret_cast<BundleInstallMsg *>(AdapterMalloc(sizeof(BundleInstallMsg)));
if (bundleInstallMsg_ == nullptr) {
AdapterFree(path);
return false;
}
if (memset_s(bundleInstallMsg_, sizeof(BundleInstallMsg), 0, sizeof(BundleInstallMsg)) != EOK) {
AdapterFree(bundleInstallMsg_);
AdapterFree(path);
return false;
}
// set bundleName、label、smallIconPath、bigIconPath in bundleInstallMsg_
@@ -320,6 +322,7 @@ void GtManagerService::InstallAllSystemBundle(InstallerCallback installerCallbac
if (!BundleUtil::IsFile(((AppInfoList *)currentNode)->filePath) ||
!BundleUtil::EndWith(((AppInfoList *)currentNode)->filePath, INSTALL_FILE_SUFFIX)) {
GtManagerService::APP_FreeAllAppInfo(list);
return;
}
(void) Install(((AppInfoList *)currentNode)->filePath, nullptr, installerCallback);