Browse Source

Fix a potential null pointer acceess issue. #1854

It's possible that c-ares calls the callback function immediately in ares_gethostbyname, which may free the server
structure in that callback function.
pull/1877/head
Max Lv 6 years ago
parent
commit
57ab828ba1
1 changed files with 2 additions and 2 deletions
  1. 4
      src/server.c

4
src/server.c

@ -903,6 +903,8 @@ server_recv_cb(EV_P_ ev_io *w, int revents)
ev_io_start(EV_A_ & remote->send_ctx->io);
}
} else {
ev_io_stop(EV_A_ & server_recv_ctx->io);
query_t *query = ss_malloc(sizeof(query_t));
memset(query, 0, sizeof(query_t));
query->server = server;
@ -920,8 +922,6 @@ server_recv_cb(EV_P_ ev_io *w, int revents)
close_and_free_server(EV_A_ server);
return;
}
ev_io_stop(EV_A_ & server_recv_ctx->io);
}
return;

Loading…
Cancel
Save