diff --git a/frameworks/bundle_lite/src/bundle_manager.cpp b/frameworks/bundle_lite/src/bundle_manager.cpp index 44d1c4aeaff8efca139f30634c81f61debdd30aa..b3678b8b1b27b2051db1e29bb2e0f5110383ebe2 100644 --- a/frameworks/bundle_lite/src/bundle_manager.cpp +++ b/frameworks/bundle_lite/src/bundle_manager.cpp @@ -793,6 +793,7 @@ uint8_t GetBundleNameForUid(int32_t uid, char **bundleName) resultOfGetBundleNameForUid.bundleName, resultOfGetBundleNameForUid.length); AdapterFree(resultOfGetBundleNameForUid.bundleName); if (err != EOK) { + AdapterFree(*bundleName); return ERR_APPEXECFWK_SYSTEM_INTERNAL_ERROR; } return resultOfGetBundleNameForUid.resultCode; diff --git a/services/bundlemgr_lite/src/bundle_info_creator.cpp b/services/bundlemgr_lite/src/bundle_info_creator.cpp index a95a6313f43b0d2804f07967a9319d83df9d7bf8..065f32ed837ea468f434a710f0882a3ef0abbd21 100755 --- a/services/bundlemgr_lite/src/bundle_info_creator.cpp +++ b/services/bundlemgr_lite/src/bundle_info_creator.cpp @@ -48,12 +48,16 @@ uint8_t BundleInfoCreator::SaveBundleInfo(const BundleProfile &bundleProfile, Bu size_t index = std::string(info->codePath).find_last_of(PATH_SEPARATOR); if (index == std::string::npos) { HILOG_ERROR(HILOG_MODULE_APP, "codePath is invalid!"); + BundleInfoUtils::FreeBundleInfo(*bundleInfo); + *bundleInfo = nullptr; return ERR_APPEXECFWK_INSTALL_FAILED_INTERNAL_ERROR; } installDirPath = std::string(info->codePath).substr(0, index); index = std::string(info->dataPath).find_last_of(PATH_SEPARATOR); if (index == std::string::npos) { HILOG_ERROR(HILOG_MODULE_APP, "dataPath is invalid!"); + BundleInfoUtils::FreeBundleInfo(*bundleInfo); + *bundleInfo = nullptr; return ERR_APPEXECFWK_INSTALL_FAILED_INTERNAL_ERROR; } dataDirPath = std::string(info->dataPath).substr(0, index);