Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
src: fix u-a-free if uv returns err in ASYNC_CALL
  • Loading branch information
skomski committed Sep 26, 2015
commit 95950253defa9052301b5b5a311ca85fdc377542
7 changes: 5 additions & 2 deletions src/node_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,10 @@ struct fs_req_wrap {
uv_req->result = err; \
uv_req->path = nullptr; \
After(uv_req); \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you set req_wrap = nullptr here?

Aside: the uv_req->path = nullptr is a memory leak waiting to happen. It's mostly benign now - I think.

} \
args.GetReturnValue().Set(req_wrap->persistent());
req_wrap = nullptr; \
} else { \
args.GetReturnValue().Set(req_wrap->persistent()); \
}

#define ASYNC_CALL(func, req, ...) \
ASYNC_DEST_CALL(func, req, nullptr, __VA_ARGS__) \
Expand Down Expand Up @@ -1028,6 +1030,7 @@ static void WriteString(const FunctionCallbackInfo<Value>& args) {
uv_req->result = err;
uv_req->path = nullptr;
After(uv_req);
return;
}

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