mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
src: fix order of CHECK_NOT_NULL/dereference
`ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS` may dereference `req_wrap_async`, so `CHECK_NOT_NULL(req_wrap_async)` should be used before and not after. PR-URL: https://github.com/nodejs/node/pull/59487 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Richard Lau <richard.lau@ibm.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
This commit is contained in:
1 parent
2a11d50526
commit
b8d145db2c
1 file changed
+1
-1
+1
-1
@@ -1633,12 +1633,12 @@ static void Unlink(const FunctionCallbackInfo<Value>& args) {
|
||||
|
||||
if (argc > 1) { // unlink(path, req)
|
||||
FSReqBase* req_wrap_async = GetReqWrap(args, 1);
|
||||
CHECK_NOT_NULL(req_wrap_async);
|
||||
ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS(
|
||||
env,
|
||||
req_wrap_async,
|
||||
permission::PermissionScope::kFileSystemWrite,
|
||||
path.ToStringView());
|
||||
CHECK_NOT_NULL(req_wrap_async);
|
||||
FS_ASYNC_TRACE_BEGIN1(
|
||||
UV_FS_UNLINK, req_wrap_async, "path", TRACE_STR_COPY(*path))
|
||||
AsyncCall(env, req_wrap_async, args, "unlink", UTF8, AfterNoArgs,
|
||||
|
||||
Reference in new issue
Block a user