mirror of
https://gitee.com/openharmony/commonlibrary_ets_utils
synced 2024-11-27 01:21:01 +00:00
!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:
commit
6b481f5122
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,6 +53,7 @@ namespace OHOS::Uri {
|
||||
auto obj = reinterpret_cast<Uri*>(data);
|
||||
if (obj != nullptr) {
|
||||
delete obj;
|
||||
obj = nullptr;
|
||||
}
|
||||
}, nullptr, nullptr));
|
||||
return thisVar;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user