diff options
author | Vijay Pai <vpai@google.com> | 2018-11-07 09:42:49 -0800 |
---|---|---|
committer | Vijay Pai <vpai@google.com> | 2018-11-07 12:33:19 -0800 |
commit | 432b34bf7430fd01f7dd3b4e7ba262846bbe1b7c (patch) | |
tree | dc79a9db6cc066844052b89ac19a619775613655 /test/cpp/qps/client.h | |
parent | 35e1f9fa6a318dac3fe232d99a5a41768f12197f (diff) |
Initialize value before creating slice
Diffstat (limited to 'test/cpp/qps/client.h')
-rw-r--r-- | test/cpp/qps/client.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h index 4ed34e0405..668d941916 100644 --- a/test/cpp/qps/client.h +++ b/test/cpp/qps/client.h @@ -94,9 +94,11 @@ class ClientRequestCreator<ByteBuffer> { public: ClientRequestCreator(ByteBuffer* req, const PayloadConfig& payload_config) { if (payload_config.has_bytebuf_params()) { - std::unique_ptr<char[]> buf( - new char[payload_config.bytebuf_params().req_size()]); - Slice slice(buf.get(), payload_config.bytebuf_params().req_size()); + size_t req_sz = + static_cast<size_t>(payload_config.bytebuf_params().req_size()); + std::unique_ptr<char[]> buf(new char[req_sz]); + memset(buf.get(), 0, req_sz); + Slice slice(buf.get(), req_sz); *req = ByteBuffer(&slice, 1); } else { GPR_ASSERT(false); // not appropriate for this specialization |