diff --git a/frameworks/src/core/base/js_fwk_common.cpp b/frameworks/src/core/base/js_fwk_common.cpp index 90a082182fb212836958cf14c935908bbd9f6a2e..e628de8c83b190556b37669d04edc1994ac6421a 100644 --- a/frameworks/src/core/base/js_fwk_common.cpp +++ b/frameworks/src/core/base/js_fwk_common.cpp @@ -517,15 +517,12 @@ char *RelocateFilePathRelative(const char * const appRootPath, const char * cons dirPath[len] = '\0'; // first splice resFileName with directory path char *filePath = RelocateFilePath(dirPath, SRC_SUB_FOLDER_NAME, resFileName); - if (filePath != nullptr) { - ace_free(dirPath); - filePath = nullptr; - } + ACE_FREE(dirPath); // second splice root path with res file path char *realPath = nullptr; if (filePath != nullptr) { realPath = RelocateFilePath(appRootPath, SRC_SUB_FOLDER_NAME, filePath); - ace_free(filePath); + ACE_FREE(filePath); } return realPath; } diff --git a/frameworks/src/core/context/js_ability_impl.cpp b/frameworks/src/core/context/js_ability_impl.cpp index 7290e6244f7684a7af2640cdb3327a825590b7fa..bd78a9eb0d2d3c1d125ca9a313b551999e56ef1a 100644 --- a/frameworks/src/core/context/js_ability_impl.cpp +++ b/frameworks/src/core/context/js_ability_impl.cpp @@ -194,6 +194,7 @@ void JSAbilityImpl::OnRestoreData(AbilitySlite::AbilitySavedData *abilitySavedDa pageInfo_ = StringUtil::Malloc(AbilitySlite::SAVED_DATA_LIMIT); if (pageInfo_ == nullptr) { InvokeOnRestoreData(EMPTY_OBJECT_JSON_STRING, AbilitySlite::SavedResultCode::SAVED_RESULT_NO_DATA); + ACE_FREE(userData); return; } uint16_t pageInfoLen = AbilitySlite::SAVED_DATA_LIMIT; @@ -203,6 +204,7 @@ void JSAbilityImpl::OnRestoreData(AbilitySlite::AbilitySavedData *abilitySavedDa ACE_FREE(pageInfo_); pageInfo_ = nullptr; InvokeOnRestoreData(EMPTY_OBJECT_JSON_STRING, AbilitySlite::SavedResultCode::SAVED_RESULT_NO_DATA); + ACE_FREE(userData); return; } diff --git a/frameworks/src/core/modules/presets/localization_module.cpp b/frameworks/src/core/modules/presets/localization_module.cpp index 0c81e4d587cba87de85d8f1fa20568e41a487ff5..0fda2b856c379691ad73ae67096771bbf9b840d5 100644 --- a/frameworks/src/core/modules/presets/localization_module.cpp +++ b/frameworks/src/core/modules/presets/localization_module.cpp @@ -93,6 +93,7 @@ jerry_value_t LocalizationModule::GetValueByKey(const jerry_value_t *args, const char *param = MallocStringOf(args[0], ¶mStrLength); if (param == nullptr || paramStrLength == 0) { HILOG_ERROR(HILOG_MODULE_ACE, "GetValueByKey failed: parse key to string error"); + ACE_FREE(param); return UNDEFINED; } jerry_value_t resultProp = localization->parser_->GetValue(param, args, argsNum);