aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/security/credentials_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/core/security/credentials_test.c')
-rw-r--r--test/core/security/credentials_test.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/test/core/security/credentials_test.c b/test/core/security/credentials_test.c
index ec21e0d42f..1c83cc8059 100644
--- a/test/core/security/credentials_test.c
+++ b/test/core/security/credentials_test.c
@@ -498,10 +498,8 @@ static void validate_service_account_http_request(
char *expected_body = NULL;
GPR_ASSERT(body != NULL);
GPR_ASSERT(body_size != 0);
- expected_body = gpr_malloc(strlen(expected_service_account_http_body_prefix) +
- strlen(test_signed_jwt) + 1);
- sprintf(expected_body, "%s%s", expected_service_account_http_body_prefix,
- test_signed_jwt);
+ gpr_asprintf(&expected_body, "%s%s",
+ expected_service_account_http_body_prefix, test_signed_jwt);
GPR_ASSERT(strlen(expected_body) == body_size);
GPR_ASSERT(!memcmp(expected_body, body, body_size));
gpr_free(expected_body);