From a9c3e0cb893d6ef0ac689c7c145e0654141044dd Mon Sep 17 00:00:00 2001 From: xusen Date: Fri, 14 Mar 2025 11:55:07 +0800 Subject: [PATCH] free worker secure memory Signed-off-by: zhouwenxuan --- js_concurrent_module/worker/worker.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/js_concurrent_module/worker/worker.cpp b/js_concurrent_module/worker/worker.cpp index 9cf09f89..759f30bf 100644 --- a/js_concurrent_module/worker/worker.cpp +++ b/js_concurrent_module/worker/worker.cpp @@ -1364,10 +1364,6 @@ void Worker::ExecuteInThread(const void* data) bool Worker::PrepareForWorkerInstance() { std::string rawFileName = script_; - uint8_t* scriptContent = nullptr; - size_t scriptContentSize = 0; - std::vector content; - std::string workerAmi; { std::lock_guard lock(liveStatusLock_); if (HostIsStop() || isHostEnvExited_) { @@ -1390,17 +1386,12 @@ bool Worker::PrepareForWorkerInstance() if (isRelativePath_) { rawFileName = fileName_; } - if (!hostEngine->GetAbcBuffer(rawFileName.c_str(), &scriptContent, &scriptContentSize, content, workerAmi)) { - HILOG_ERROR("worker:: GetAbcBuffer error"); - return false; - } } // add timer interface Timer::RegisterTime(workerEnv_); - HILOG_DEBUG("worker:: stringContent size is %{public}zu", scriptContentSize); napi_value execScriptResult = nullptr; - napi_status status = napi_run_actor(workerEnv_, scriptContent, scriptContentSize, - workerAmi.c_str(), &execScriptResult, const_cast(script_.c_str())); + napi_status status = napi_run_actor(workerEnv_, const_cast(rawFileName.c_str()), + const_cast(script_.c_str()), &execScriptResult); if (status != napi_ok || execScriptResult == nullptr) { // An exception occurred when running the script. HILOG_ERROR("worker:: run script exception occurs, will handle exception"); -- Gitee