Skip to content

Commit 7d5c82f

Browse files
committed
fix CR comments
1 parent cfb2313 commit 7d5c82f

File tree

2 files changed

+15
-30
lines changed

2 files changed

+15
-30
lines changed

src/aws/flb_aws_credentials.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,6 @@
3838

3939
#define EKS_POD_EXECUTION_ROLE "EKS_POD_EXECUTION_ROLE"
4040

41-
/* IoT Credentials Environment Variables */
42-
#define AWS_IOT_KEY_FILE "AWS_IOT_KEY_FILE"
43-
#define AWS_IOT_CERT_FILE "AWS_IOT_CERT_FILE"
44-
#define AWS_IOT_CA_CERT_FILE "AWS_IOT_CA_CERT_FILE"
45-
#define AWS_IOT_CREDENTIALS_ENDPOINT "AWS_IOT_CREDENTIALS_ENDPOINT"
46-
#define AWS_IOT_THING_NAME "AWS_IOT_THING_NAME"
47-
#define AWS_IOT_ROLE_ALIAS "AWS_IOT_ROLE_ALIAS"
48-
4941
/* declarations */
5042
static struct flb_aws_provider *standard_chain_create(struct flb_config
5143
*config,
@@ -59,11 +51,6 @@ static struct flb_aws_provider *standard_chain_create(struct flb_config
5951
int eks_irsa,
6052
char *profile);
6153

62-
/* IoT Provider declaration */
63-
struct flb_aws_provider *flb_iot_provider_create(struct flb_config *config,
64-
struct flb_aws_client_generator *generator);
65-
66-
6754
/*
6855
* The standard credential provider chain:
6956
* 1. Environment variables

src/aws/flb_aws_credentials_iot.c

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
#include <fluent-bit/flb_jsmn.h>
2626
#include <fluent-bit/flb_output_plugin.h>
2727
#include <fluent-bit/flb_utils.h>
28+
#include <fluent-bit/flb_log.h>
29+
#include <fluent-bit/flb_mem.h>
2830

2931
#include <stdlib.h>
3032
#include <time.h>
@@ -377,22 +379,18 @@ struct flb_aws_provider *flb_iot_provider_create(struct flb_config *config,
377379
implementation->client->static_headers = &implementation->thing_name_header;
378380
implementation->client->static_headers_len = 1;
379381

380-
/* Clean up temporary variables */
381-
flb_sds_destroy(protocol);
382-
flb_sds_destroy(host);
383-
flb_sds_destroy(port_sds);
384-
flb_sds_destroy(endpoint_path);
385-
386-
return provider;
387-
388-
error:
389-
flb_aws_provider_destroy(provider);
390-
flb_sds_destroy(protocol);
391-
flb_sds_destroy(host);
392-
flb_sds_destroy(port_sds);
393-
flb_sds_destroy(endpoint_path);
394-
return NULL;
395-
}
382+
goto cleanup; // At the end of the func
383+
error:
384+
flb_aws_provider_destroy(provider);
385+
provider = NULL;
386+
// if no return it just keep executing :)
387+
cleanup:
388+
flb_sds_destroy(protocol);
389+
flb_sds_destroy(host);
390+
flb_sds_destroy(port_sds);
391+
flb_sds_destroy(endpoint_path);
392+
return provider;
393+
}
396394

397395
static int iot_credentials_request(struct flb_aws_provider_iot *implementation)
398396
{
@@ -648,4 +646,4 @@ static struct flb_aws_credentials *flb_parse_iot_credentials(char *response, siz
648646
flb_aws_credentials_destroy(creds);
649647
flb_free(tokens);
650648
return NULL;
651-
}
649+
}

0 commit comments

Comments
 (0)