Skip to content

Commit 283399e

Browse files
authored
Fix warnings found by the Undefined Behavior Sanitizer (#530)
Signed-off-by: Björn Svensson <[email protected]>
1 parent e80cd2d commit 283399e

File tree

3 files changed

+34
-18
lines changed

3 files changed

+34
-18
lines changed

source/connection_manager.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,8 @@ static void s_aws_http_connection_manager_execute_transaction(struct aws_connect
692692
* cancels the culling task and then calls this function. If we are not using idle connection culling, we can
693693
* call this function immediately from the start of destruction.
694694
*/
695-
static void s_aws_http_connection_manager_finish_destroy(struct aws_http_connection_manager *manager) {
695+
static void s_aws_http_connection_manager_finish_destroy(void *user_data) {
696+
struct aws_http_connection_manager *manager = user_data;
696697
if (manager == NULL) {
697698
return;
698699
}

source/http2_stream_manager.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
/* 3 seconds */
3636
static const size_t s_default_ping_timeout_ms = 3000;
3737

38-
static void s_stream_manager_start_destroy(struct aws_http2_stream_manager *stream_manager);
3938
static void s_aws_http2_stream_manager_build_transaction_synced(struct aws_http2_stream_management_transaction *work);
4039
static void s_aws_http2_stream_manager_execute_transaction(struct aws_http2_stream_management_transaction *work);
4140

@@ -1016,7 +1015,8 @@ void s_stream_manager_on_cm_shutdown_complete(void *user_data) {
10161015
s_stream_manager_destroy_final(stream_manager);
10171016
}
10181017

1019-
static void s_stream_manager_start_destroy(struct aws_http2_stream_manager *stream_manager) {
1018+
static void s_stream_manager_start_destroy(void *user_data) {
1019+
struct aws_http2_stream_manager *stream_manager = user_data;
10201020
STREAM_MANAGER_LOG(TRACE, stream_manager, "Stream Manager reaches the condition to destroy, start to destroy");
10211021
/* If there is no outstanding streams, the connections set should be empty. */
10221022
AWS_ASSERT(aws_random_access_set_get_size(&stream_manager->synced_data.ideal_available_set) == 0);
@@ -1031,7 +1031,8 @@ static void s_stream_manager_start_destroy(struct aws_http2_stream_manager *stre
10311031
aws_http_connection_manager_release(cm);
10321032
}
10331033

1034-
void s_stream_manager_on_zero_external_ref(struct aws_http2_stream_manager *stream_manager) {
1034+
void s_stream_manager_on_zero_external_ref(void *user_data) {
1035+
struct aws_http2_stream_manager *stream_manager = user_data;
10351036
STREAM_MANAGER_LOG(
10361037
TRACE,
10371038
stream_manager,

source/proxy_strategy.c

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ struct aws_http_proxy_strategy_basic_auth {
8383
struct aws_http_proxy_strategy strategy_base;
8484
};
8585

86-
static void s_destroy_basic_auth_strategy(struct aws_http_proxy_strategy *proxy_strategy) {
86+
static void s_destroy_basic_auth_strategy(void *user_data) {
87+
struct aws_http_proxy_strategy *proxy_strategy = user_data;
8788
struct aws_http_proxy_strategy_basic_auth *basic_auth_strategy = proxy_strategy->impl;
8889

8990
aws_string_destroy(basic_auth_strategy->user_name);
@@ -102,7 +103,8 @@ struct aws_http_proxy_negotiator_basic_auth {
102103
struct aws_http_proxy_negotiator negotiator_base;
103104
};
104105

105-
static void s_destroy_basic_auth_negotiator(struct aws_http_proxy_negotiator *proxy_negotiator) {
106+
static void s_destroy_basic_auth_negotiator(void *user_data) {
107+
struct aws_http_proxy_negotiator *proxy_negotiator = user_data;
106108
struct aws_http_proxy_negotiator_basic_auth *basic_auth_negotiator = proxy_negotiator->impl;
107109

108110
aws_http_proxy_strategy_release(basic_auth_negotiator->strategy);
@@ -356,7 +358,8 @@ struct aws_http_proxy_negotiator_one_time_identity {
356358
struct aws_http_proxy_negotiator negotiator_base;
357359
};
358360

359-
static void s_destroy_one_time_identity_negotiator(struct aws_http_proxy_negotiator *proxy_negotiator) {
361+
static void s_destroy_one_time_identity_negotiator(void *user_data) {
362+
struct aws_http_proxy_negotiator *proxy_negotiator = user_data;
360363
struct aws_http_proxy_negotiator_one_time_identity *identity_negotiator = proxy_negotiator->impl;
361364

362365
aws_mem_release(identity_negotiator->allocator, identity_negotiator);
@@ -432,7 +435,8 @@ static struct aws_http_proxy_strategy_vtable s_one_time_identity_proxy_strategy_
432435
.create_negotiator = s_create_one_time_identity_negotiator,
433436
};
434437

435-
static void s_destroy_one_time_identity_strategy(struct aws_http_proxy_strategy *proxy_strategy) {
438+
static void s_destroy_one_time_identity_strategy(void *user_data) {
439+
struct aws_http_proxy_strategy *proxy_strategy = user_data;
436440
struct aws_http_proxy_strategy_one_time_identity *identity_strategy = proxy_strategy->impl;
437441

438442
aws_mem_release(identity_strategy->allocator, identity_strategy);
@@ -478,7 +482,8 @@ struct aws_http_proxy_negotiator_forwarding_identity {
478482
struct aws_http_proxy_negotiator negotiator_base;
479483
};
480484

481-
static void s_destroy_forwarding_identity_negotiator(struct aws_http_proxy_negotiator *proxy_negotiator) {
485+
static void s_destroy_forwarding_identity_negotiator(void *user_data) {
486+
struct aws_http_proxy_negotiator *proxy_negotiator = user_data;
482487
struct aws_http_proxy_negotiator_forwarding_identity *identity_negotiator = proxy_negotiator->impl;
483488

484489
aws_mem_release(identity_negotiator->allocator, identity_negotiator);
@@ -529,7 +534,8 @@ static struct aws_http_proxy_strategy_vtable s_forwarding_identity_strategy_vtab
529534
.create_negotiator = s_create_forwarding_identity_negotiator,
530535
};
531536

532-
static void s_destroy_forwarding_identity_strategy(struct aws_http_proxy_strategy *proxy_strategy) {
537+
static void s_destroy_forwarding_identity_strategy(void *user_data) {
538+
struct aws_http_proxy_strategy *proxy_strategy = user_data;
533539
struct aws_http_proxy_strategy_forwarding_identity *identity_strategy = proxy_strategy->impl;
534540

535541
aws_mem_release(identity_strategy->allocator, identity_strategy);
@@ -748,7 +754,8 @@ static struct aws_http_proxy_negotiator_tunnelling_vtable s_tunneling_kerberos_p
748754
.connect_request_transform = s_kerberos_tunnel_transform_connect,
749755
};
750756

751-
static void s_destroy_tunneling_kerberos_negotiator(struct aws_http_proxy_negotiator *proxy_negotiator) {
757+
static void s_destroy_tunneling_kerberos_negotiator(void *user_data) {
758+
struct aws_http_proxy_negotiator *proxy_negotiator = user_data;
752759
struct aws_http_proxy_negotiator_tunneling_kerberos *kerberos_negotiator = proxy_negotiator->impl;
753760

754761
aws_http_proxy_strategy_release(kerberos_negotiator->strategy);
@@ -789,7 +796,8 @@ static struct aws_http_proxy_strategy_vtable s_tunneling_kerberos_strategy_vtabl
789796
.create_negotiator = s_create_tunneling_kerberos_negotiator,
790797
};
791798

792-
static void s_destroy_tunneling_kerberos_strategy(struct aws_http_proxy_strategy *proxy_strategy) {
799+
static void s_destroy_tunneling_kerberos_strategy(void *user_data) {
800+
struct aws_http_proxy_strategy *proxy_strategy = user_data;
793801
struct aws_http_proxy_strategy_tunneling_kerberos *kerberos_strategy = proxy_strategy->impl;
794802

795803
aws_mem_release(kerberos_strategy->allocator, kerberos_strategy);
@@ -1044,7 +1052,8 @@ static struct aws_http_proxy_negotiator_tunnelling_vtable s_tunneling_ntlm_proxy
10441052
.get_retry_directive = s_ntlm_tunnel_get_retry_directive,
10451053
};
10461054

1047-
static void s_destroy_tunneling_ntlm_negotiator(struct aws_http_proxy_negotiator *proxy_negotiator) {
1055+
static void s_destroy_tunneling_ntlm_negotiator(void *user_data) {
1056+
struct aws_http_proxy_negotiator *proxy_negotiator = user_data;
10481057
struct aws_http_proxy_negotiator_tunneling_ntlm *ntlm_negotiator = proxy_negotiator->impl;
10491058

10501059
aws_string_destroy(ntlm_negotiator->challenge_token);
@@ -1086,7 +1095,8 @@ static struct aws_http_proxy_strategy_vtable s_tunneling_ntlm_strategy_vtable =
10861095
.create_negotiator = s_create_tunneling_ntlm_negotiator,
10871096
};
10881097

1089-
static void s_destroy_tunneling_ntlm_strategy(struct aws_http_proxy_strategy *proxy_strategy) {
1098+
static void s_destroy_tunneling_ntlm_strategy(void *user_data) {
1099+
struct aws_http_proxy_strategy *proxy_strategy = user_data;
10901100
struct aws_http_proxy_strategy_tunneling_ntlm *ntlm_strategy = proxy_strategy->impl;
10911101

10921102
aws_mem_release(ntlm_strategy->allocator, ntlm_strategy);
@@ -1189,7 +1199,8 @@ static struct aws_http_proxy_negotiator_tunnelling_vtable
11891199
.connect_request_transform = s_ntlm_credential_tunnel_transform_connect,
11901200
};
11911201

1192-
static void s_destroy_tunneling_ntlm_credential_negotiator(struct aws_http_proxy_negotiator *proxy_negotiator) {
1202+
static void s_destroy_tunneling_ntlm_credential_negotiator(void *user_data) {
1203+
struct aws_http_proxy_negotiator *proxy_negotiator = user_data;
11931204
struct aws_http_proxy_negotiator_tunneling_ntlm *ntlm_credential_negotiator = proxy_negotiator->impl;
11941205

11951206
aws_string_destroy(ntlm_credential_negotiator->challenge_token);
@@ -1231,7 +1242,8 @@ static struct aws_http_proxy_strategy_vtable s_tunneling_ntlm_credential_strateg
12311242
.create_negotiator = s_create_tunneling_ntlm_credential_negotiator,
12321243
};
12331244

1234-
static void s_destroy_tunneling_ntlm_credential_strategy(struct aws_http_proxy_strategy *proxy_strategy) {
1245+
static void s_destroy_tunneling_ntlm_credential_strategy(void *user_data) {
1246+
struct aws_http_proxy_strategy *proxy_strategy = user_data;
12351247
struct aws_http_proxy_strategy_tunneling_ntlm *ntlm_credential_strategy = proxy_strategy->impl;
12361248

12371249
aws_mem_release(ntlm_credential_strategy->allocator, ntlm_credential_strategy);
@@ -1548,7 +1560,8 @@ static struct aws_http_proxy_negotiator_tunnelling_vtable s_tunneling_sequence_p
15481560
.get_retry_directive = s_sequence_get_retry_directive,
15491561
};
15501562

1551-
static void s_destroy_tunneling_sequence_negotiator(struct aws_http_proxy_negotiator *proxy_negotiator) {
1563+
static void s_destroy_tunneling_sequence_negotiator(void *user_data) {
1564+
struct aws_http_proxy_negotiator *proxy_negotiator = user_data;
15521565
struct aws_http_proxy_negotiator_tunneling_sequence *sequence_negotiator = proxy_negotiator->impl;
15531566

15541567
size_t negotiator_count = aws_array_list_length(&sequence_negotiator->negotiators);
@@ -1628,7 +1641,8 @@ static struct aws_http_proxy_strategy_vtable s_tunneling_sequence_strategy_vtabl
16281641
.create_negotiator = s_create_tunneling_sequence_negotiator,
16291642
};
16301643

1631-
static void s_destroy_tunneling_sequence_strategy(struct aws_http_proxy_strategy *proxy_strategy) {
1644+
static void s_destroy_tunneling_sequence_strategy(void *user_data) {
1645+
struct aws_http_proxy_strategy *proxy_strategy = user_data;
16321646
struct aws_http_proxy_strategy_tunneling_sequence *sequence_strategy = proxy_strategy->impl;
16331647

16341648
size_t strategy_count = aws_array_list_length(&sequence_strategy->strategies);

0 commit comments

Comments
 (0)