From 50c3d6707aef920e12286370e20211bf4e2bba8c Mon Sep 17 00:00:00 2001 From: zhangxinyu Date: Thu, 24 Aug 2023 21:02:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=89=E5=85=A8=E6=8E=92=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangxinyu --- frameworks/bundle_lite/src/bundle_manager.cpp | 1 + services/bundlemgr_lite/src/bundle_info_creator.cpp | 4 ++++ 2 files changed, 5 insertions(+) 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); -- Gitee