Skip to content

Commit 80d13c7

Browse files
committed
fix copilot comments
1 parent 5f73fa7 commit 80d13c7

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/aws/flb_aws_credentials_iot.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -371,18 +371,17 @@ struct flb_aws_provider *flb_iot_provider_create(struct flb_config *config,
371371
implementation->client->static_headers = &implementation->thing_name_header;
372372
implementation->client->static_headers_len = 1;
373373

374-
goto cleanup; // At the end of the func
375-
error:
376-
flb_aws_provider_destroy(provider);
377-
provider = NULL;
378-
// if no return it just keep executing :)
379374
cleanup:
380375
flb_sds_destroy(protocol);
381376
flb_sds_destroy(host);
382377
flb_sds_destroy(port_sds);
383378
flb_sds_destroy(endpoint_path);
384379
return provider;
385-
}
380+
error:
381+
flb_aws_provider_destroy(provider);
382+
provider = NULL;
383+
goto cleanup;
384+
}
386385

387386
static int iot_credentials_request(struct flb_aws_provider_iot *implementation)
388387
{
@@ -549,7 +548,7 @@ static struct flb_aws_credentials *flb_parse_iot_credentials(char *response, siz
549548
current_token = &response[t->start];
550549
len = t->end - t->start;
551550
if (creds->access_key_id != NULL) {
552-
flb_error("Trying to double allocate access_key_id");
551+
flb_error("[aws_credentials] Trying to double allocate access_key_id");
553552
goto error;
554553
}
555554
creds->access_key_id = flb_sds_create_len(current_token, len);
@@ -567,7 +566,7 @@ static struct flb_aws_credentials *flb_parse_iot_credentials(char *response, siz
567566
current_token = &response[t->start];
568567
len = t->end - t->start;
569568
if (creds->secret_access_key != NULL) {
570-
flb_error("Trying to double allocate secret_access_key");
569+
flb_error("[aws_credentials] Trying to double allocate secret_access_key");
571570
goto error;
572571
}
573572
creds->secret_access_key = flb_sds_create_len(current_token, len);
@@ -585,7 +584,7 @@ static struct flb_aws_credentials *flb_parse_iot_credentials(char *response, siz
585584
current_token = &response[t->start];
586585
len = t->end - t->start;
587586
if (creds->session_token != NULL) {
588-
flb_error("Trying to double allocate session_token");
587+
flb_error("[aws_credentials] Trying to double allocate session_token");
589588
goto error;
590589
}
591590
creds->session_token = flb_sds_create_len(current_token, len);

0 commit comments

Comments
 (0)