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 4c34891

Browse filesBrowse files
theanarkhRafaelGSS
authored andcommitted
src: fix dns crash when failed to create NodeAresTask
PR-URL: #55521 Fixes: #52439 Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 2b99285 commit 4c34891
Copy full SHA for 4c34891

File tree

Expand file treeCollapse file tree

1 file changed

+4
-9
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-9
lines changed
Open diff view settings
Collapse file

‎src/cares_wrap.cc‎

Copy file name to clipboardExpand all lines: src/cares_wrap.cc
+4-9Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,10 @@ void ares_sockstate_cb(void* data, ares_socket_t sock, int read, int write) {
145145
ares_poll_cb);
146146

147147
} else {
148-
/* read == 0 and write == 0 this is c-ares's way of notifying us that */
149-
/* the socket is now closed. We must free the data associated with */
150-
/* socket. */
151-
CHECK(task &&
152-
"When an ares socket is closed we should have a handle for it");
153-
154-
channel->task_list()->erase(it);
155-
channel->env()->CloseHandle(&task->poll_watcher, ares_poll_close_cb);
148+
if (task != nullptr) {
149+
channel->task_list()->erase(it);
150+
channel->env()->CloseHandle(&task->poll_watcher, ares_poll_close_cb);
151+
}
156152

157153
if (channel->task_list()->empty()) {
158154
channel->CloseTimer();
@@ -683,7 +679,6 @@ GetNameInfoReqWrap::GetNameInfoReqWrap(
683679
void ChannelWrap::AresTimeout(uv_timer_t* handle) {
684680
ChannelWrap* channel = static_cast<ChannelWrap*>(handle->data);
685681
CHECK_EQ(channel->timer_handle(), handle);
686-
CHECK_EQ(false, channel->task_list()->empty());
687682
ares_process_fd(channel->cares_channel(), ARES_SOCKET_BAD, ARES_SOCKET_BAD);
688683
}
689684

0 commit comments

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