Fix free-after-use bug in server callback handler (#27187)

Successful asan run https://source.cloud.google.com/results/invocations/33bc587c-a440-45bd-9886-a23789645a7d/targets

Successful TGP available upon request.
reviewable/pr27215/r1
AJ Heller 3 years ago committed by GitHub
parent b9cf89c86c
commit 0407f4be49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      include/grpcpp/impl/codegen/server_callback_handlers.h

@ -81,7 +81,7 @@ class CallbackUnaryHandler : public ::grpc::internal::MethodHandler {
::grpc::ByteBuffer buf;
buf.set_buffer(req);
RequestType* request = nullptr;
MessageHolder<RequestType, ResponseType>* allocator_state = nullptr;
MessageHolder<RequestType, ResponseType>* allocator_state;
if (allocator_ != nullptr) {
allocator_state = allocator_->AllocateMessages();
} else {
@ -98,8 +98,6 @@ class CallbackUnaryHandler : public ::grpc::internal::MethodHandler {
if (status->ok()) {
return request;
}
// Clean up on deserialization failure.
allocator_state->Release();
return nullptr;
}

Loading…
Cancel
Save