Skip to content

Commit

Permalink
Fix lifetime issue with EventEngine endpoint wrapper. Before, we woul…
Browse files Browse the repository at this point in the history
…d delete the wrapper in `grpc_take_wrapped_event_engine_endpoint`, which could destroy the wrapper before the refs became zero and lead to use-after-free / illegal instruction / segfault errors if callbacks return after the wrapper is destroyed. Now, we unref the wrapper instead of explicitly deleting it.

PiperOrigin-RevId: 705673089
  • Loading branch information
ananda1066 authored and copybara-github committed Dec 13, 2024
1 parent 4e0c1d4 commit 0498194
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/lib/iomgr/event_engine_shims/endpoint.cc
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ std::unique_ptr<EventEngine::Endpoint> grpc_take_wrapped_event_engine_endpoint(
reinterpret_cast<EventEngineEndpointWrapper::grpc_event_engine_endpoint*>(
ep);
auto endpoint = eeep->wrapper->ReleaseEndpoint();
delete eeep->wrapper;
eeep->wrapper->Unref();
return endpoint;
}

Expand Down

0 comments on commit 0498194

Please sign in to comment.