Skip to content

Commit 2314378

Browse files
skomskijasnell
authored andcommitted
src: fix u-a-free if uv returns err in ASYNC_CALL
PR-URL: #3049 Reviewed-By: Ben Noordhuis <[email protected]>
1 parent af24376 commit 2314378

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/node_file.cc

+5-2
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,10 @@ struct fs_req_wrap {
273273
uv_req->result = err; \
274274
uv_req->path = nullptr; \
275275
After(uv_req); \
276-
} \
277-
args.GetReturnValue().Set(req_wrap->persistent());
276+
req_wrap = nullptr; \
277+
} else { \
278+
args.GetReturnValue().Set(req_wrap->persistent()); \
279+
}
278280

279281
#define ASYNC_CALL(func, req, ...) \
280282
ASYNC_DEST_CALL(func, req, nullptr, __VA_ARGS__) \
@@ -1028,6 +1030,7 @@ static void WriteString(const FunctionCallbackInfo<Value>& args) {
10281030
uv_req->result = err;
10291031
uv_req->path = nullptr;
10301032
After(uv_req);
1033+
return;
10311034
}
10321035

10331036
return args.GetReturnValue().Set(req_wrap->persistent());

0 commit comments

Comments
 (0)