Fix memory leak

pull/1969/head
Craig Tiller 10 years ago
parent 8f789fd4b9
commit 928ec8ee51
  1. 5
      include/grpc++/impl/proto_utils.h
  2. 1
      src/cpp/server/server.cc

@ -36,6 +36,7 @@
#include <type_traits>
#include <grpc/grpc.h>
#include <grpc++/impl/serialization_traits.h>
#include <grpc++/config_protobuf.h>
#include <grpc++/status.h>
@ -66,7 +67,9 @@ class SerializationTraits<T, typename std::enable_if<std::is_base_of<
static Status Deserialize(grpc_byte_buffer* buffer,
grpc::protobuf::Message* msg,
int max_message_size) {
return DeserializeProto(buffer, msg, max_message_size);
auto status = DeserializeProto(buffer, msg, max_message_size);
grpc_byte_buffer_destroy(buffer);
return status;
}
};

@ -129,6 +129,7 @@ class Server::SyncRequest GRPC_FINAL : public CompletionQueueTag {
ctx_.BeginCompletionOp(&call_);
method_->handler()->RunHandler(MethodHandler::HandlerParameter(
&call_, &ctx_, request_payload_, call_.max_message_size()));
request_payload_ = nullptr;
void* ignored_tag;
bool ignored_ok;
cq_.Shutdown();

Loading…
Cancel
Save