Skip to content

Commit b8d145d

Browse files
tniessenmarco-ippolito
authored andcommitted
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: #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>
1 parent 2a11d50 commit b8d145d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/node_file.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1633,12 +1633,12 @@ static void Unlink(const FunctionCallbackInfo<Value>& args) {
16331633

16341634
if (argc > 1) { // unlink(path, req)
16351635
FSReqBase* req_wrap_async = GetReqWrap(args, 1);
1636+
CHECK_NOT_NULL(req_wrap_async);
16361637
ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS(
16371638
env,
16381639
req_wrap_async,
16391640
permission::PermissionScope::kFileSystemWrite,
16401641
path.ToStringView());
1641-
CHECK_NOT_NULL(req_wrap_async);
16421642
FS_ASYNC_TRACE_BEGIN1(
16431643
UV_FS_UNLINK, req_wrap_async, "path", TRACE_STR_COPY(*path))
16441644
AsyncCall(env, req_wrap_async, args, "unlink", UTF8, AfterNoArgs,

0 commit comments

Comments
 (0)