Skip to content

Commit 924e2d6

Browse files
committed
aws_credentials_sts: internal: Use early return when allocation is failed
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
1 parent 012f6e1 commit 924e2d6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/internal/aws_credentials_sts.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,9 @@ struct flb_http_client *request_sts_test1(struct flb_aws_client *aws_client,
305305
mk_list_init(&c->headers);
306306
payload = build_sts_response_with_ttl_calloc(3600, &payload_len);
307307
TEST_CHECK(payload != NULL);
308+
if (!payload) {
309+
return NULL;
310+
}
308311

309312
http_test_attach_owned_payload(c, payload, payload_len);
310313

@@ -469,6 +472,9 @@ static void test_process_sts_response()
469472
}
470473
payload = build_eks_response_with_ttl_calloc(3600, &payload_len);
471474
TEST_CHECK(payload != NULL);
475+
if (!payload) {
476+
return NULL;
477+
}
472478

473479
creds = flb_parse_sts_resp(payload, &expiration);
474480

0 commit comments

Comments
 (0)