TCP Async Connect: Fix Heap use-after-free (#29209)

pull/29210/head
Yash Tibrewal 3 years ago committed by GitHub
parent 6989129db5
commit d303f81ab4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/core/lib/iomgr/tcp_client_posix.cc

@ -136,6 +136,7 @@ static void on_writable(void* acp, grpc_error_handle error) {
int done;
grpc_endpoint** ep = ac->ep;
grpc_closure* closure = ac->closure;
std::string addr_str = ac->addr_str;
grpc_fd* fd;
(void)GRPC_ERROR_REF(error);
@ -221,8 +222,7 @@ finish:
std::string description =
absl::StrCat("Failed to connect to remote host: ", str);
error = grpc_error_set_str(error, GRPC_ERROR_STR_DESCRIPTION, description);
error =
grpc_error_set_str(error, GRPC_ERROR_STR_TARGET_ADDRESS, ac->addr_str);
error = grpc_error_set_str(error, GRPC_ERROR_STR_TARGET_ADDRESS, addr_str);
}
if (done) {
// This is safe even outside the lock, because "done", the sentinel, is

Loading…
Cancel
Save