diff --git a/src/apps/relay/http_server.c b/src/apps/relay/http_server.c index c0b71c68..d852cb49 100644 --- a/src/apps/relay/http_server.c +++ b/src/apps/relay/http_server.c @@ -120,7 +120,7 @@ static struct headers_list *post_parse(char *data, size_t data_len) { memcpy(post_data, data, data_len); char *fmarker = NULL; char *fsplit = strtok_r(post_data, "&", &fmarker); - struct headers_list *list = (struct headers_list *)calloc(sizeof(struct headers_list), 1); + struct headers_list *list = (struct headers_list *)calloc(1, sizeof(struct headers_list)); while (fsplit != NULL) { char *vmarker = NULL; char *key = strtok_r(fsplit, "=", &vmarker); @@ -173,7 +173,7 @@ static struct http_request *parse_http_request_1(struct http_request *ret, char const char *query = evhttp_uri_get_query(uri); if (query) { - struct evkeyvalq *kv = (struct evkeyvalq *)calloc(sizeof(struct evkeyvalq), 1); + struct evkeyvalq *kv = (struct evkeyvalq *)calloc(1, sizeof(struct evkeyvalq)); if (evhttp_parse_query_str(query, kv) < 0) { free(ret); ret = NULL; @@ -182,7 +182,7 @@ static struct http_request *parse_http_request_1(struct http_request *ret, char free(kv); } } else { - ret->headers = (struct http_headers *)calloc(sizeof(struct http_headers), 1); + ret->headers = (struct http_headers *)calloc(1, sizeof(struct http_headers)); ret->headers->uri_headers = kv; } } @@ -198,7 +198,7 @@ static struct http_request *parse_http_request_1(struct http_request *ret, char char *body = strstr(s + 1, "\r\n\r\n"); if (body && body[0]) { if (!ret->headers) { - ret->headers = (struct http_headers *)calloc(sizeof(struct http_headers), 1); + ret->headers = (struct http_headers *)calloc(1, sizeof(struct http_headers)); } ret->headers->post_headers = post_parse(body, strlen(body)); } @@ -218,7 +218,7 @@ struct http_request *parse_http_request(char *request) { if (request) { - ret = (struct http_request *)calloc(sizeof(struct http_request), 1); + ret = (struct http_request *)calloc(1, sizeof(struct http_request)); if (ret == NULL) { TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "%s: failure in call to calloc \n", __FUNCTION__); @@ -340,7 +340,7 @@ struct str_buffer { }; struct str_buffer *str_buffer_new(void) { - struct str_buffer *ret = (struct str_buffer *)calloc(sizeof(struct str_buffer), 1); + struct str_buffer *ret = (struct str_buffer *)calloc(1, sizeof(struct str_buffer)); if (!ret) { return NULL; } diff --git a/src/apps/relay/ns_ioalib_engine_impl.c b/src/apps/relay/ns_ioalib_engine_impl.c index fbee5b43..5d691de3 100644 --- a/src/apps/relay/ns_ioalib_engine_impl.c +++ b/src/apps/relay/ns_ioalib_engine_impl.c @@ -940,7 +940,7 @@ ioa_socket_handle create_unbound_relay_ioa_socket(ioa_engine_handle e, int famil return NULL; } - ret = (ioa_socket *)calloc(sizeof(ioa_socket), 1); + ret = (ioa_socket *)calloc(1, sizeof(ioa_socket)); if (ret == NULL) { TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "%s: failure in call to calloc \n", __FUNCTION__); @@ -1361,7 +1361,7 @@ ioa_socket_handle create_ioa_socket_from_fd(ioa_engine_handle e, ioa_socket_raw return NULL; } - ret = (ioa_socket *)calloc(sizeof(ioa_socket), 1); + ret = (ioa_socket *)calloc(1, sizeof(ioa_socket)); if (ret == NULL) { TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "%s: failure in call to calloc \n", __FUNCTION__); @@ -1629,7 +1629,7 @@ ioa_socket_handle detach_ioa_socket(ioa_socket_handle s) { ioa_network_buffer_delete(s->e, s->defer_nbh); - ret = (ioa_socket *)calloc(sizeof(ioa_socket), 1); + ret = (ioa_socket *)calloc(1, sizeof(ioa_socket)); if (!ret) { TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "%s: Cannot allocate new socket structure\n", __FUNCTION__); if (udp_fd >= 0) { diff --git a/src/apps/relay/turn_admin_server.c b/src/apps/relay/turn_admin_server.c index af3b26c1..f52e4de3 100644 --- a/src/apps/relay/turn_admin_server.c +++ b/src/apps/relay/turn_admin_server.c @@ -1172,7 +1172,7 @@ static void cliserver_input_handler(struct evconnlistener *l, evutil_socket_t fd addr_debug_print(adminserver.verbose, (ioa_addr *)sa, "CLI connected to"); - struct cli_session *clisession = (struct cli_session *)calloc(sizeof(struct cli_session), 1); + struct cli_session *clisession = (struct cli_session *)calloc(1, sizeof(struct cli_session)); if (clisession == NULL) { TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "%s: failure in call to calloc \n", __FUNCTION__); return; @@ -3321,7 +3321,7 @@ static void handle_logon_request(ioa_socket_handle s, struct http_request *hr) { struct admin_session *as = (struct admin_session *)s->special_session; if (!as) { - as = (struct admin_session *)calloc(sizeof(struct admin_session), 1); + as = (struct admin_session *)calloc(1, sizeof(struct admin_session)); if (!as) { return; } diff --git a/src/apps/relay/userdb.c b/src/apps/relay/userdb.c index 7d30d7be..35904cbf 100644 --- a/src/apps/relay/userdb.c +++ b/src/apps/relay/userdb.c @@ -1180,7 +1180,7 @@ const ip_range_list_t *ioa_get_blacklist(ioa_engine_handle e) { } ip_range_list_t *get_ip_list(const char *kind) { - ip_range_list_t *ret = (ip_range_list_t *)calloc(sizeof(ip_range_list_t), 1); + ip_range_list_t *ret = (ip_range_list_t *)calloc(1, sizeof(ip_range_list_t)); const turn_dbdriver_t *dbd = get_dbdriver(); if (dbd && dbd->get_ip_list && !turn_params.no_dynamic_ip_list) { diff --git a/src/apps/uclient/startuclient.c b/src/apps/uclient/startuclient.c index f685d0d4..3da31544 100644 --- a/src/apps/uclient/startuclient.c +++ b/src/apps/uclient/startuclient.c @@ -1591,7 +1591,7 @@ again: const int i = (int)(elem->pinfo.tcp_conn_number - 1); elem->pinfo.tcp_conn = (app_tcp_conn_info **)realloc(elem->pinfo.tcp_conn, elem->pinfo.tcp_conn_number * sizeof(app_tcp_conn_info *)); - elem->pinfo.tcp_conn[i] = (app_tcp_conn_info *)calloc(sizeof(app_tcp_conn_info), 1); + elem->pinfo.tcp_conn[i] = (app_tcp_conn_info *)calloc(1, sizeof(app_tcp_conn_info)); if (elem->pinfo.tcp_conn[i] == NULL) { TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "%s: failure in call to calloc \n", __FUNCTION__); diff --git a/src/server/ns_turn_maps_rtcp.c b/src/server/ns_turn_maps_rtcp.c index af665fed..83560909 100644 --- a/src/server/ns_turn_maps_rtcp.c +++ b/src/server/ns_turn_maps_rtcp.c @@ -177,7 +177,7 @@ static bool rtcp_map_init(rtcp_map *map, ioa_engine_handle e) { } rtcp_map *rtcp_map_create(ioa_engine_handle e) { - rtcp_map *map = (rtcp_map *)calloc(sizeof(rtcp_map), 1); + rtcp_map *map = (rtcp_map *)calloc(1, sizeof(rtcp_map)); if (!rtcp_map_init(map, e)) { free(map); return NULL; @@ -194,7 +194,7 @@ bool rtcp_map_put(rtcp_map *map, rtcp_token_type token, ioa_socket_handle s) { if (!rtcp_map_valid(map)) { return false; } else { - rtcp_alloc_type *value = (rtcp_alloc_type *)calloc(sizeof(rtcp_alloc_type), 1); + rtcp_alloc_type *value = (rtcp_alloc_type *)calloc(1, sizeof(rtcp_alloc_type)); if (!value) { return false; } diff --git a/src/server/ns_turn_server.c b/src/server/ns_turn_server.c index 3395abb8..9afe806b 100644 --- a/src/server/ns_turn_server.c +++ b/src/server/ns_turn_server.c @@ -803,7 +803,7 @@ static ts_ur_super_session *create_new_ss(turn_turnserver *server) { // // printf("%s: 111.111: session size=%lu\n",__FUNCTION__,(unsigned long)sizeof(ts_ur_super_session)); // - ts_ur_super_session *ss = (ts_ur_super_session *)calloc(sizeof(ts_ur_super_session), 1); + ts_ur_super_session *ss = (ts_ur_super_session *)calloc(1, sizeof(ts_ur_super_session)); if (!ss) { return NULL; }