Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7c75539

Browse filesBrowse files
theanarkhdanielleadams
authored andcommitted
dns: fix cares memory leak
PR-URL: #43912 Refs: #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>
1 parent efd5e0e commit 7c75539
Copy full SHA for 7c75539

File tree

Expand file treeCollapse file tree

1 file changed

+1
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+1
-2
lines changed
Open diff view settings
Collapse file

‎src/cares_wrap.cc‎

Copy file name to clipboardExpand all lines: src/cares_wrap.cc
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,6 +1428,7 @@ static void Query(const FunctionCallbackInfo<Value>& args) {
14281428

14291429

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

1491-
uv_freeaddrinfo(res);
1492-
14931492
TRACE_EVENT_NESTABLE_ASYNC_END2(
14941493
TRACING_CATEGORY_NODE2(dns, native), "lookup", req_wrap.get(),
14951494
"count", n, "verbatim", verbatim);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.