dns: fix cares memory leak

PR-URL: https://github.com/nodejs/node/pull/43912
Refs: https://github.com/nodejs/node/pull/39735
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
This commit is contained in:
theanarkh authored and GitHub committed 2022-07-24 06:04:54 +01:00
1 parent 7ef069e483
commit d63a4cbbd8
1 file changed
+1 -2
+1 -2
View File
@@ -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();
@@ -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);