From 0126ef22f34d37b9342f42e276e83e903ccef777 Mon Sep 17 00:00:00 2001 From: xsz233 Date: Thu, 24 Nov 2022 09:59:12 +0800 Subject: [PATCH] fix alerts 1124 Signed-off-by: xsz233 --- services/bundlemgr_lite/src/gt_bundle_manager_service.cpp | 1 + services/bundlemgr_lite/src/gt_extractor_util.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/services/bundlemgr_lite/src/gt_bundle_manager_service.cpp b/services/bundlemgr_lite/src/gt_bundle_manager_service.cpp index adcb1f5..5b646f8 100644 --- a/services/bundlemgr_lite/src/gt_bundle_manager_service.cpp +++ b/services/bundlemgr_lite/src/gt_bundle_manager_service.cpp @@ -496,6 +496,7 @@ void GtManagerService::ScanThirdApp(const char *appDir, const List(AdapterMalloc(MAX_BUNDLE_NAME_LEN + 1)); if (bundleName == nullptr) { + closedir(dir); return; } int32_t entLen = 0; diff --git a/services/bundlemgr_lite/src/gt_extractor_util.cpp b/services/bundlemgr_lite/src/gt_extractor_util.cpp index cdfff6d..13b167a 100644 --- a/services/bundlemgr_lite/src/gt_extractor_util.cpp +++ b/services/bundlemgr_lite/src/gt_extractor_util.cpp @@ -108,7 +108,7 @@ uint8_t GtExtractorUtil::ExtractFileHeaderInfo(int32_t fp, char **bundleName) return ERR_APPEXECFWK_INSTALL_FAILED_FILE_DATA_INVALID; } - if ((*bundleName = (char *)ReadString(fp, bundleNameLen)) == nullptr) { + if ((*bundleName = reinterpret_cast(ReadString(fp, bundleNameLen))) == nullptr) { return ERR_APPEXECFWK_INSTALL_FAILED_FILE_DATA_INVALID; } return ERR_OK; @@ -136,7 +136,7 @@ uint8_t GtExtractorUtil::ExtractFileAttr(int32_t fp, char **fileName, char **rel return ERR_APPEXECFWK_INSTALL_FAILED_FILE_DATA_INVALID; } - if ((*fileName = (char *)ReadString(fp, nameLen)) == nullptr) { + if ((*fileName = reinterpret_cast(ReadString(fp, nameLen))) == nullptr) { HILOG_ERROR(HILOG_MODULE_AAFWK, "[BMS] Read fileName fail"); return ERR_APPEXECFWK_INSTALL_FAILED_FILE_DATA_INVALID; } @@ -146,7 +146,7 @@ uint8_t GtExtractorUtil::ExtractFileAttr(int32_t fp, char **fileName, char **rel HILOG_ERROR(HILOG_MODULE_AAFWK, "[BMS] Read path Int fail"); return ERR_APPEXECFWK_INSTALL_FAILED_FILE_DATA_INVALID; } else { - if ((*relativeFilePath = (char *)ReadString(fp, pathLen)) == nullptr) { + if ((*relativeFilePath = reinterpret_cast(ReadString(fp, pathLen))) == nullptr) { HILOG_ERROR(HILOG_MODULE_AAFWK, "[BMS] Read relativeFilePath fail"); return ERR_APPEXECFWK_INSTALL_FAILED_FILE_DATA_INVALID; } @@ -168,7 +168,7 @@ uint8_t GtExtractorUtil::ExtractFileAttr(int32_t fp, char **fileName, uint32_t & return ERR_APPEXECFWK_INSTALL_FAILED_FILE_DATA_INVALID; } - if ((*fileName = (char *)ReadString(fp, nameLen)) == nullptr) { + if ((*fileName = reinterpret_cast(ReadString(fp, nameLen))) == nullptr) { HILOG_ERROR(HILOG_MODULE_AAFWK, "[BMS] Read fileName fail"); return ERR_APPEXECFWK_INSTALL_FAILED_FILE_DATA_INVALID; } -- Gitee