Skip to content

Commit

Permalink
dns: fix cares memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
theanarkh committed Jul 20, 2022
1 parent 95d9140 commit 7860433
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/cares_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1428,6 +1428,7 @@ static void Query(const FunctionCallbackInfo<Value>& args) {


void AfterGetAddrInfo(uv_getaddrinfo_t* req, int status, struct addrinfo* res) {
auto cleanup = OnScopeLeave([&]() { uv_freeaddrinfo(res); });
std::unique_ptr<GetAddrInfoReqWrap> req_wrap {
static_cast<GetAddrInfoReqWrap*>(req->data)};
Environment* env = req_wrap->env();
Expand Down Expand Up @@ -1488,8 +1489,6 @@ void AfterGetAddrInfo(uv_getaddrinfo_t* req, int status, struct addrinfo* res) {
argv[1] = results;
}

uv_freeaddrinfo(res);

TRACE_EVENT_NESTABLE_ASYNC_END2(
TRACING_CATEGORY_NODE2(dns, native), "lookup", req_wrap.get(),
"count", n, "verbatim", verbatim);
Expand Down

0 comments on commit 7860433

Please sign in to comment.