Skip to content

Commit abd5ee2

Browse files
committed
tests: internal: aws_credentials_http: fix leaks
Signed-off-by: Eduardo Silva <eduardo@calyptia.com>
1 parent 5a46ae0 commit abd5ee2

File tree

1 file changed

+3
-48
lines changed

1 file changed

+3
-48
lines changed

tests/internal/aws_credentials_http.c

+3-48
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,6 @@ static void test_http_provider()
183183
struct flb_aws_credentials *creds;
184184
int ret;
185185
struct flb_config *config;
186-
flb_sds_t host;
187-
flb_sds_t path;
188186

189187
g_request_count = 0;
190188

@@ -194,19 +192,6 @@ static void test_http_provider()
194192
return;
195193
}
196194

197-
host = flb_sds_create("127.0.0.1");
198-
if (!host) {
199-
flb_errno();
200-
flb_config_exit(config);
201-
return;
202-
}
203-
path = flb_sds_create("/happy-case");
204-
if (!path) {
205-
flb_errno();
206-
flb_config_exit(config);
207-
return;
208-
}
209-
210195
provider = flb_http_provider_create(config, generator_in_test());
211196

212197
if (!provider) {
@@ -261,8 +246,6 @@ static void test_http_provider_error_case()
261246
struct flb_aws_credentials *creds;
262247
int ret;
263248
struct flb_config *config;
264-
flb_sds_t host;
265-
flb_sds_t path;
266249

267250
g_request_count = 0;
268251

@@ -272,21 +255,7 @@ static void test_http_provider_error_case()
272255
return;
273256
}
274257

275-
host = flb_sds_create("127.0.0.1");
276-
if (!host) {
277-
flb_errno();
278-
flb_config_exit(config);
279-
return;
280-
}
281-
path = flb_sds_create("/error-case");
282-
if (!path) {
283-
flb_errno();
284-
flb_config_exit(config);
285-
return;
286-
}
287-
288258
provider = flb_http_provider_create(config, generator_in_test());
289-
290259
if (!provider) {
291260
flb_errno();
292261
flb_config_exit(config);
@@ -311,6 +280,7 @@ static void test_http_provider_error_case()
311280
*/
312281
TEST_CHECK(g_request_count == 3);
313282

283+
314284
flb_aws_provider_destroy(provider);
315285
flb_config_exit(config);
316286
}
@@ -321,8 +291,6 @@ static void test_http_provider_malformed_response()
321291
struct flb_aws_credentials *creds;
322292
int ret;
323293
struct flb_config *config;
324-
flb_sds_t host;
325-
flb_sds_t path;
326294

327295
g_request_count = 0;
328296

@@ -334,19 +302,6 @@ static void test_http_provider_malformed_response()
334302

335303
mk_list_init(&config->upstreams);
336304

337-
host = flb_sds_create("127.0.0.1");
338-
if (!host) {
339-
flb_errno();
340-
flb_config_exit(config);
341-
return;
342-
}
343-
path = flb_sds_create("/malformed");
344-
if (!path) {
345-
flb_errno();
346-
flb_config_exit(config);
347-
return;
348-
}
349-
350305
provider = flb_http_provider_create(config, generator_in_test());
351306

352307
if (!provider) {
@@ -774,7 +729,6 @@ static void test_http_validator_invalid_host()
774729

775730
flb_aws_client_mock_destroy_generator();
776731
flb_free(config);
777-
778732
}
779733

780734
static void test_http_validator_invalid_port()
@@ -789,6 +743,8 @@ static void test_http_validator_invalid_port()
789743

790744
config = flb_calloc(1, sizeof(struct flb_config));
791745
TEST_ASSERT(config != NULL);
746+
TEST_ASSERT(config != NULL);
747+
792748
mk_list_init(&config->upstreams);
793749

794750
/* provider creation will fail with error message indicating port was invalid */
@@ -797,7 +753,6 @@ static void test_http_validator_invalid_port()
797753

798754
flb_aws_client_mock_destroy_generator();
799755
flb_free(config);
800-
801756
}
802757

803758
TEST_LIST = {

0 commit comments

Comments
 (0)