!1604 Set the native obj pointer to nullptr after release in uri url buffer module

Merge pull request !1604 from 赵杜炜/1106urlbug
This commit is contained in:
openharmony_ci 2024-11-11 02:25:13 +00:00 committed by Gitee
commit 6b481f5122
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 7 additions and 0 deletions

View File

@ -45,6 +45,7 @@ void FinalizeBufferCallback(napi_env env, void *finalizeData, void *finalizeHint
if (finalizeData != nullptr) {
auto obj = reinterpret_cast<Buffer *>(finalizeData);
delete obj;
obj = nullptr;
}
}
@ -53,6 +54,7 @@ void FinalizeBlobCallback(napi_env env, void *finalizeData, void *finalizeHint)
if (finalizeData != nullptr) {
auto obj = reinterpret_cast<Blob *>(finalizeData);
delete obj;
obj = nullptr;
}
}

View File

@ -53,6 +53,7 @@ namespace OHOS::Uri {
auto obj = reinterpret_cast<Uri*>(data);
if (obj != nullptr) {
delete obj;
obj = nullptr;
}
}, nullptr, nullptr));
return thisVar;

View File

@ -136,6 +136,7 @@ namespace OHOS::Url {
auto obj = reinterpret_cast<URL*>(data);
if (obj != nullptr) {
delete obj;
obj = nullptr;
}
},
nullptr, nullptr);
@ -518,6 +519,7 @@ namespace OHOS::Url {
auto obj = reinterpret_cast<URLSearchParams*>(data);
if (obj != nullptr) {
delete obj;
obj = nullptr;
}
},
nullptr, nullptr);

View File

@ -524,6 +524,7 @@ namespace OHOS::Util {
reinterpret_cast<const void*>(stdEncodeInfo->sinputEncoding), bufferSize) != EOK) {
HILOG_ERROR("Base64:: copy ret to arraybuffer error");
napi_delete_async_work(env, stdEncodeInfo->worker);
napi_close_handle_scope(env, scope);
return;
}
napi_value result = nullptr;
@ -758,6 +759,7 @@ namespace OHOS::Util {
reinterpret_cast<const void*>(stdDecodeInfo->sinputDecoding), bufferSize) != EOK) {
HILOG_ERROR("Base64:: copy ret to arraybuffer error");
napi_delete_async_work(env, stdDecodeInfo->worker);
napi_close_handle_scope(env, scope);
return;
}
napi_value result = nullptr;