diff --git a/frameworks/bundle_lite/src/bundle_manager.cpp b/frameworks/bundle_lite/src/bundle_manager.cpp index 44d1c4a..b3678b8 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 a95a631..065f32e 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);