From 0407f4be49d5754bbc2e5bc011c55b58e17d4f42 Mon Sep 17 00:00:00 2001 From: AJ Heller Date: Tue, 31 Aug 2021 11:01:57 -0700 Subject: [PATCH] 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. --- include/grpcpp/impl/codegen/server_callback_handlers.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/grpcpp/impl/codegen/server_callback_handlers.h b/include/grpcpp/impl/codegen/server_callback_handlers.h index 6c66c42e747a5..11115dd6e9b24 100644 --- a/include/grpcpp/impl/codegen/server_callback_handlers.h +++ b/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* allocator_state = nullptr; + MessageHolder* 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; }