diff options
author | Craig Tiller <craig.tiller@gmail.com> | 2016-10-17 13:33:19 -0700 |
---|---|---|
committer | Craig Tiller <craig.tiller@gmail.com> | 2016-10-17 13:33:19 -0700 |
commit | 68cf8ce8662e58aa1ebdb2dbccbb8bc270f8aade (patch) | |
tree | 292f7143d37495a9b63d420ee2cc2dbdef01b4c1 | |
parent | 8c94df19d44c9939bdaca69b98bb96d081afb87d (diff) |
Fix payload tests under windows
-rw-r--r-- | test/core/end2end/tests/payload.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/test/core/end2end/tests/payload.c b/test/core/end2end/tests/payload.c index ed1c719ef8..40696d088f 100644 --- a/test/core/end2end/tests/payload.c +++ b/test/core/end2end/tests/payload.c @@ -99,12 +99,16 @@ static void end_test(grpc_end2end_test_fixture *f) { static gpr_slice generate_random_slice() { size_t i; static const char chars[] = "abcdefghijklmnopqrstuvwxyz1234567890"; - char output[1024 * 1024]; - for (i = 0; i < GPR_ARRAY_SIZE(output) - 1; ++i) { + char *output; + const size_t output_size = 1024 * 1024; + output = gpr_malloc(output_size); + for (i = 0; i < output_size - 1; ++i) { output[i] = chars[rand() % (int)(sizeof(chars) - 1)]; } - output[GPR_ARRAY_SIZE(output) - 1] = '\0'; - return gpr_slice_from_copied_string(output); + output[output_size - 1] = '\0'; + gpr_slice out = gpr_slice_from_copied_string(output); + gpr_free(output); + return out; } static void request_response_with_payload(grpc_end2end_test_fixture f) { |