From b4109be58431bcd915d032d97c24a9119947da9c Mon Sep 17 00:00:00 2001 From: Vijay Pai <vpai@google.com> Date: Fri, 28 Sep 2018 09:01:38 -0700 Subject: [PATCH] Confirm that generic API method name is not needed after call creation --- test/cpp/end2end/generic_end2end_test.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/cpp/end2end/generic_end2end_test.cc b/test/cpp/end2end/generic_end2end_test.cc index 88a1227ca2..0bdaf83618 100644 --- a/test/cpp/end2end/generic_end2end_test.cc +++ b/test/cpp/end2end/generic_end2end_test.cc @@ -123,8 +123,16 @@ class GenericEnd2endTest : public ::testing::Test { cli_ctx.set_deadline(deadline); } + // Rather than using the original kMethodName, make a short-lived + // copy to also confirm that we don't refer to this object beyond + // the initial call preparation + const grpc::string* method_name = new grpc::string(kMethodName); + std::unique_ptr<GenericClientAsyncReaderWriter> call = - generic_stub_->PrepareCall(&cli_ctx, kMethodName, &cli_cq_); + generic_stub_->PrepareCall(&cli_ctx, *method_name, &cli_cq_); + + delete method_name; // Make sure that this is not needed after invocation + call->StartCall(tag(1)); client_ok(1); std::unique_ptr<ByteBuffer> send_buffer = -- GitLab