Skip to content
This repository has been archived by the owner on Nov 6, 2023. It is now read-only.

Commit

Permalink
Fix free-after-use bug in server callback handler (grpc#27187)
Browse files Browse the repository at this point in the history
  • Loading branch information
drfloob authored Aug 31, 2021
1 parent b9cf89c commit 0407f4b
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions include/grpcpp/impl/codegen/server_callback_handlers.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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;
}

Expand Down

0 comments on commit 0407f4b

Please sign in to comment.