diff options
37 files changed, 103 insertions, 103 deletions
diff --git a/epan/dissectors/asn1/lte-rrc/packet-lte-rrc-template.c b/epan/dissectors/asn1/lte-rrc/packet-lte-rrc-template.c index f5bc326fd7..360bd2270f 100644 --- a/epan/dissectors/asn1/lte-rrc/packet-lte-rrc-template.c +++ b/epan/dissectors/asn1/lte-rrc/packet-lte-rrc-template.c @@ -2702,7 +2702,7 @@ static lte_rrc_private_data_t* lte_rrc_get_private_data(asn1_ctx_t *actx) } else { lte_rrc_private_data_t* new_struct = - (lte_rrc_private_data_t*)wmem_alloc0(wmem_packet_scope(), sizeof(lte_rrc_private_data_t)); + wmem_new0(wmem_packet_scope(), lte_rrc_private_data_t); actx->private_data = new_struct; return new_struct; } diff --git a/epan/dissectors/packet-bthci_acl.c b/epan/dissectors/packet-bthci_acl.c index 55ed7f2f15..412f4f30dd 100644 --- a/epan/dissectors/packet-bthci_acl.c +++ b/epan/dissectors/packet-bthci_acl.c @@ -374,7 +374,7 @@ dissect_bthci_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat key[5].length = 0; key[5].key = NULL; - chandle_data = (chandle_data_t *)wmem_alloc(wmem_file_scope(), sizeof(chandle_data_t)); + chandle_data = wmem_new(wmem_file_scope(), chandle_data_t); chandle_data->start_fragments = wmem_tree_new(wmem_file_scope()); wmem_tree_insert32_array(chandle_tree, key, chandle_data); diff --git a/epan/dissectors/packet-btmesh-proxy.c b/epan/dissectors/packet-btmesh-proxy.c index 476463efcf..e06b9576b7 100644 --- a/epan/dissectors/packet-btmesh-proxy.c +++ b/epan/dissectors/packet-btmesh-proxy.c @@ -171,7 +171,7 @@ dissect_btmesh_proxy_configuration_msg(tvbuff_t *tvb, packet_info *pinfo, proto_ proto_tree_add_item(tree, hf_btmesh_proxy_data, tvb, 0, tvb_reported_length(tvb), ENC_NA); - dec_ctx = (network_decryption_ctx_t *)wmem_alloc(wmem_packet_scope(), sizeof(network_decryption_ctx_t)); + dec_ctx = wmem_new(wmem_packet_scope(), network_decryption_ctx_t); dec_ctx->net_nonce_type = BTMESH_NONCE_TYPE_PROXY; de_obf_tvb = btmesh_network_find_key_and_decrypt(tvb, pinfo, &decrypted_data, &enc_data_len, dec_ctx); diff --git a/epan/dissectors/packet-btmesh.c b/epan/dissectors/packet-btmesh.c index ebd07ff43e..656335f71e 100644 --- a/epan/dissectors/packet-btmesh.c +++ b/epan/dissectors/packet-btmesh.c @@ -3377,7 +3377,7 @@ dissect_btmesh_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da proto_tree_add_item(sub_tree, hf_btmesh_nid, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; - dec_ctx = (network_decryption_ctx_t *)wmem_alloc(wmem_packet_scope(), sizeof(network_decryption_ctx_t)); + dec_ctx = wmem_new(wmem_packet_scope(), network_decryption_ctx_t); dec_ctx->net_nonce_type = BTMESH_NONCE_TYPE_NETWORK; de_obf_tvb = btmesh_network_find_key_and_decrypt(tvb, pinfo, &decrypted_data, &enc_data_len, dec_ctx); diff --git a/epan/dissectors/packet-cops.c b/epan/dissectors/packet-cops.c index 0e79d12ed8..c76f4b0d97 100644 --- a/epan/dissectors/packet-cops.c +++ b/epan/dissectors/packet-cops.c @@ -1019,7 +1019,7 @@ dissect_cops_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data conversation = find_or_create_conversation(pinfo); cops_conv_info = (cops_conv_info_t *)conversation_get_proto_data(conversation, proto_cops); if (!cops_conv_info) { - cops_conv_info = (cops_conv_info_t *)wmem_alloc(wmem_file_scope(), sizeof(cops_conv_info_t)); + cops_conv_info = wmem_new(wmem_file_scope(), cops_conv_info_t); cops_conv_info->pdus_tree = wmem_map_new(wmem_file_scope(), g_direct_hash, g_direct_equal); conversation_add_proto_data(conversation, proto_cops, cops_conv_info); diff --git a/epan/dissectors/packet-dcerpc-nt.c b/epan/dissectors/packet-dcerpc-nt.c index 6852d2b7aa..d1d9e3c768 100644 --- a/epan/dissectors/packet-dcerpc-nt.c +++ b/epan/dissectors/packet-dcerpc-nt.c @@ -605,10 +605,10 @@ static void add_pol_handle(e_ctx_hnd *policy_hnd, guint32 frame, * and put the hash value in the policy handle hash * table. */ - value = (pol_hash_value *)wmem_alloc(wmem_file_scope(), sizeof(pol_hash_value)); + value = wmem_new(wmem_file_scope(), pol_hash_value); value->list = pol; pol->next = NULL; - key = (pol_hash_key *)wmem_alloc(wmem_file_scope(), sizeof(pol_hash_key)); + key = wmem_new(wmem_file_scope(), pol_hash_key); memcpy(&key->policy_hnd, policy_hnd, sizeof(key->policy_hnd)); wmem_map_insert(pol_hash, key, value); } else { @@ -705,7 +705,7 @@ void dcerpc_smb_store_pol_pkts(e_ctx_hnd *policy_hnd, packet_info *pinfo, /* Create a new value */ - pol = (pol_value *)wmem_alloc(wmem_file_scope(), sizeof(pol_value)); + pol = wmem_new(wmem_file_scope(), pol_value); pol->open_frame = is_open ? pinfo->num : 0; pol->close_frame = is_close ? pinfo->num : 0; @@ -787,7 +787,7 @@ void dcerpc_store_polhnd_name(e_ctx_hnd *policy_hnd, packet_info *pinfo, /* Create a new value */ - pol = (pol_value *)wmem_alloc(wmem_file_scope(), sizeof(pol_value)); + pol = wmem_new(wmem_file_scope(), pol_value); pol->open_frame = 0; pol->close_frame = 0; diff --git a/epan/dissectors/packet-dcerpc.c b/epan/dissectors/packet-dcerpc.c index 5ee62a30b1..9e6b2bac7c 100644 --- a/epan/dissectors/packet-dcerpc.c +++ b/epan/dissectors/packet-dcerpc.c @@ -6218,7 +6218,7 @@ dissect_dcerpc_dg_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, wmem_map_insert(dcerpc_dg_calls, call_key, call_value); - new_matched_key = (dcerpc_matched_key *)wmem_alloc(wmem_file_scope(), sizeof(dcerpc_matched_key)); + new_matched_key = wmem_new(wmem_file_scope(), dcerpc_matched_key); new_matched_key->frame = pinfo->num; new_matched_key->call_id = hdr->seqnum; wmem_map_insert(dcerpc_matched, new_matched_key, call_value); diff --git a/epan/dissectors/packet-dcm.c b/epan/dissectors/packet-dcm.c index 569bd19d7d..0377862576 100644 --- a/epan/dissectors/packet-dcm.c +++ b/epan/dissectors/packet-dcm.c @@ -809,7 +809,7 @@ dcm_state_assoc_new(dcm_state_t *dcm_data, guint32 packet_no) dcm_state_assoc_t *assoc; - assoc = (dcm_state_assoc_t *) wmem_alloc0(wmem_file_scope(), sizeof(dcm_state_assoc_t)); + assoc = wmem_new0(wmem_file_scope(), dcm_state_assoc_t); assoc->packet_no = packet_no; /* Identifier */ /* add to the end of the list */ @@ -861,7 +861,7 @@ dcm_state_pctx_new(dcm_state_assoc_t *assoc, guint8 pctx_id) dcm_state_pctx_t *pctx; - pctx = (dcm_state_pctx_t *)wmem_alloc0(wmem_file_scope(), sizeof(dcm_state_pctx_t)); + pctx = wmem_new0(wmem_file_scope(), dcm_state_pctx_t); pctx->id = pctx_id; pctx->syntax = DCM_UNK; @@ -910,7 +910,7 @@ dcm_state_pdv_new(dcm_state_pctx_t *pctx, guint32 packet_no, guint32 offset) { dcm_state_pdv_t *pdv; - pdv = (dcm_state_pdv_t *) wmem_alloc0(wmem_file_scope(), sizeof(dcm_state_pdv_t)); + pdv = wmem_new0(wmem_file_scope(), dcm_state_pdv_t); pdv->syntax = DCM_UNK; pdv->is_last_fragment = TRUE; /* Continuation PDVs are more tricky */ pdv->packet_no = packet_no; @@ -1375,7 +1375,7 @@ dcm_export_create_object(packet_info *pinfo, dcm_state_assoc_t *assoc, dcm_state memmove(pdv_combined_curr, pdv->data, pdv->data_len); /* this is a copy not a move */ /* Add to list */ - eo_info = (dicom_eo_t *)wmem_alloc0(wmem_file_scope(), sizeof(dicom_eo_t)); + eo_info = wmem_new0(wmem_file_scope(), dicom_eo_t); eo_info->hostname = g_strdup(hostname); eo_info->filename = g_strdup(filename); eo_info->content_type = g_strdup(pdv->desc); diff --git a/epan/dissectors/packet-diameter.c b/epan/dissectors/packet-diameter.c index 94c4de4145..139e5a5e90 100644 --- a/epan/dissectors/packet-diameter.c +++ b/epan/dissectors/packet-diameter.c @@ -398,7 +398,7 @@ diameterstat_init(struct register_srt* srt _U_, GArray* srt_array) g_hash_table_destroy(diameterstat_cmd_str_hash); } - idx = (int *)wmem_alloc0(wmem_epan_scope(), sizeof(int)); + idx = wmem_new0(wmem_epan_scope(), int); diameterstat_cmd_str_hash = g_hash_table_new(g_str_hash,g_str_equal); g_hash_table_insert(diameterstat_cmd_str_hash, "Unknown", idx); @@ -430,7 +430,7 @@ diameterstat_packet(void *pss, packet_info *pinfo, epan_dissect_t *edt _U_, cons idx = (int*) g_hash_table_lookup(diameterstat_cmd_str_hash, diameter->cmd_str); if (idx == NULL) { - idx = (int *)wmem_alloc(wmem_epan_scope(), sizeof(int)); + idx = wmem_new(wmem_epan_scope(), int); *idx = (int) g_hash_table_size(diameterstat_cmd_str_hash); g_hash_table_insert(diameterstat_cmd_str_hash, (gchar*) diameter->cmd_str, idx); init_srt_table_row(diameter_srt_table, *idx, (const char*) diameter->cmd_str); @@ -1359,7 +1359,7 @@ dissect_diameter_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi int packet_len; proto_item *pi, *cmd_item, *app_item, *version_item; proto_tree *diam_tree; - diam_ctx_t *c = (diam_ctx_t *)wmem_alloc0(wmem_packet_scope(), sizeof(diam_ctx_t)); + diam_ctx_t *c = wmem_new0(wmem_packet_scope(), diam_ctx_t); int offset; value_string *cmd_vs; const char *cmd_str; @@ -1538,7 +1538,7 @@ dissect_diameter_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if (!diameter_pair) { /* create a "fake" diameter_pair structure */ - diameter_pair = (diameter_req_ans_pair_t *)wmem_alloc(wmem_packet_scope(), sizeof(diameter_req_ans_pair_t)); + diameter_pair = wmem_new(wmem_packet_scope(), diameter_req_ans_pair_t); diameter_pair->hop_by_hop_id = hop_by_hop_id; diameter_pair->cmd_code = cmd; diameter_pair->result_code = 0; @@ -1689,7 +1689,7 @@ dissect_diameter_avps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void proto_item *pi; proto_tree *diam_tree; int offset = 0; - diam_ctx_t *c = (diam_ctx_t *)wmem_alloc0(wmem_packet_scope(), sizeof(diam_ctx_t)); + diam_ctx_t *c = wmem_new0(wmem_packet_scope(), diam_ctx_t); diam_sub_dis_t *diam_sub_dis_inf = wmem_new0(wmem_packet_scope(), diam_sub_dis_t); /* Load header fields if not already done */ @@ -1864,8 +1864,8 @@ build_proto_avp(const avp_type_t *type _U_, guint32 code, diam_vnd_t *vendor, const char *name _U_, const value_string *vs _U_, void *data) { - diam_avp_t *a = (diam_avp_t *)wmem_alloc0(wmem_epan_scope(), sizeof(diam_avp_t)); - proto_avp_t *t = (proto_avp_t *)wmem_alloc0(wmem_epan_scope(), sizeof(proto_avp_t)); + diam_avp_t *a = wmem_new0(wmem_epan_scope(), diam_avp_t); + proto_avp_t *t = wmem_new0(wmem_epan_scope(), proto_avp_t); gint *ettp = &(a->ett); a->code = code; @@ -1921,7 +1921,7 @@ build_simple_avp(const avp_type_t *type, guint32 code, diam_vnd_t *vendor, base = (field_display_e)(base|BASE_EXT_STRING); } - a = (diam_avp_t *)wmem_alloc0(wmem_epan_scope(), sizeof(diam_avp_t)); + a = wmem_new0(wmem_epan_scope(), diam_avp_t); a->code = code; a->vendor = vendor; a->dissector_v16 = type->v16; @@ -1941,7 +1941,7 @@ build_appid_avp(const avp_type_t *type, guint32 code, diam_vnd_t *vendor, diam_avp_t *a; field_display_e base; - a = (diam_avp_t *)wmem_alloc0(wmem_epan_scope(), sizeof(diam_avp_t)); + a = wmem_new0(wmem_epan_scope(), diam_avp_t); a->code = code; a->vendor = vendor; a->dissector_v16 = type->v16; diff --git a/epan/dissectors/packet-dof.c b/epan/dissectors/packet-dof.c index 63ada07558..7b64bc6038 100644 --- a/epan/dissectors/packet-dof.c +++ b/epan/dissectors/packet-dof.c @@ -1549,7 +1549,7 @@ static void oap_1_define_alias(dof_api_data *api_data, guint32 alias, oap_1_bind */ if (!g_hash_table_lookup(oap_1_alias_to_binding, &key)) { - oap_1_alias_key *alias_ptr = (oap_1_alias_key *)wmem_alloc0(wmem_file_scope(), sizeof(oap_1_alias_key)); + oap_1_alias_key *alias_ptr = wmem_new0(wmem_file_scope(), oap_1_alias_key); memcpy(alias_ptr, &key, sizeof(oap_1_alias_key)); g_hash_table_insert(oap_1_alias_to_binding, alias_ptr, binding); } @@ -5858,7 +5858,7 @@ static void remember_offset(packet_info *pinfo, tcp_session_data *session, tcp_p *seqptr = sequence; if (id == NULL) { - *last = (tcp_ignore_data *)wmem_alloc0(wmem_file_scope(), sizeof(tcp_ignore_data)); + *last = wmem_new0(wmem_file_scope(), tcp_ignore_data); id = *last; id->ignore = ignore; id->sequence = tcpinfo->seq; @@ -6002,7 +6002,7 @@ static int dissect_dof_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (packet->dof_packets == NULL) { ref_is_new = TRUE; - ref = (tcp_dof_packet_ref *)wmem_alloc0(wmem_file_scope(), sizeof(tcp_dof_packet_ref)); + ref = wmem_new0(wmem_file_scope(), tcp_dof_packet_ref); ref->transport_packet.sender_id = assign_addr_port_id(&pinfo->src, pinfo->srcport); ref->transport_packet.receiver_id = assign_addr_port_id(&pinfo->dst, pinfo->destport); packet->dof_packets = ref; @@ -6207,7 +6207,7 @@ static int dissect_tunnel_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre if (packet->dof_packets == NULL) { ref_is_new = TRUE; - ref = (tcp_dof_packet_ref *)wmem_alloc0(wmem_file_scope(), sizeof(tcp_dof_packet_ref)); + ref = wmem_new0(wmem_file_scope(), tcp_dof_packet_ref); ref->transport_packet.sender_id = assign_addr_port_id(&pinfo->src, pinfo->srcport); ref->transport_packet.receiver_id = assign_addr_port_id(&pinfo->dst, pinfo->destport); packet->dof_packets = ref; @@ -6531,7 +6531,7 @@ static int dissect_dnp_1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, vo api_data->session = dof_ns_session_retrieve(api_data->transport_session->transport_session_id, client, server); if (api_data->session == NULL) { - dof_session_data *sdata = (dof_session_data *)wmem_alloc0(wmem_file_scope(), sizeof(dof_session_data)); + dof_session_data *sdata = wmem_new0(wmem_file_scope(), dof_session_data); dof_ns_session_define(api_data->transport_session->transport_session_id, client, server, sdata); sdata->session_id = globals.next_session++; sdata->dof_id = dnp_version; @@ -7468,7 +7468,7 @@ static int dissect_ccm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void if (!ccm_data) { /* We need to parse the initialization data. */ - ccm_data = (ccm_session_data *)wmem_alloc0(wmem_file_scope(), sizeof(ccm_session_data)); + ccm_data = wmem_new0(wmem_file_scope(), ccm_session_data); if (!ccm_data) return 0; wmem_register_callback(wmem_file_scope(), dof_sessions_destroy_cb, ccm_data); @@ -7705,7 +7705,7 @@ static int dissect_ccm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void pdata = (ccm_packet_data *)dof_packet->security_packet; if (!pdata) { - pdata = (ccm_packet_data *)wmem_alloc0(wmem_file_scope(), sizeof(ccm_packet_data)); + pdata = wmem_new0(wmem_file_scope(), ccm_packet_data); if (pdata) { dof_packet->security_packet = pdata; @@ -8158,7 +8158,7 @@ static int dissect_oap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void oap_packet = (oap_1_packet_data *)dof_packet_get_proto_data(packet_data, proto_oap_1); if (!oap_packet) { - oap_packet = (oap_1_packet_data *)wmem_alloc0(wmem_file_scope(), sizeof(oap_1_packet_data)); + oap_packet = wmem_new0(wmem_file_scope(), oap_1_packet_data); dof_packet_add_proto_data(packet_data, proto_oap_1, oap_packet); } @@ -8509,7 +8509,7 @@ static int dissect_oap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void if (alias_length && !packet_data->processed) { guint32 alias; - oap_1_binding *binding = (oap_1_binding *)wmem_alloc0(wmem_file_scope(), sizeof(oap_1_binding)); + oap_1_binding *binding = wmem_new0(wmem_file_scope(), oap_1_binding); int i; alias = 0; @@ -8823,7 +8823,7 @@ static int dissect_sgmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi tvb_memcpy(identity, identity_buf, 0, identity_length); { - sgmp_data = (sgmp_packet_data *)wmem_alloc0(wmem_file_scope(), sizeof(sgmp_packet_data)); + sgmp_data = wmem_new0(wmem_file_scope(), sgmp_packet_data); dof_packet_add_proto_data(packet_data, proto_sgmp, sgmp_data); sgmp_data->domain_length = domain_length; @@ -9290,10 +9290,10 @@ static int dissect_tep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void rekey_data = (tep_rekey_data *)packet->opid_data; if (!rekey_data) { - packet->opid_data = rekey_data = (tep_rekey_data *)wmem_alloc0(wmem_file_scope(), sizeof(tep_rekey_data)); + packet->opid_data = rekey_data = wmem_new0(wmem_file_scope(), tep_rekey_data); } - rekey_data->key_data = (dof_session_key_exchange_data *)wmem_alloc0(wmem_file_scope(), sizeof(dof_session_key_exchange_data)); + rekey_data->key_data = wmem_new0(wmem_file_scope(), dof_session_key_exchange_data); rekey_data->is_rekey = TRUE; /* The K bit must be set, so there is a domain ONLY IF NOT SECURED. */ @@ -9338,7 +9338,7 @@ static int dissect_tep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void /* TODO: Output error. */ return 0; } - packet->opid_data = rekey_data = (tep_rekey_data *)wmem_alloc0(wmem_file_scope(), sizeof(tep_rekey_data)); + packet->opid_data = rekey_data = wmem_new0(wmem_file_scope(), tep_rekey_data); rekey_data->domain_length = api_data->secure_session->domain_length; rekey_data->domain = api_data->secure_session->domain; } @@ -9565,11 +9565,11 @@ static int dissect_tep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void if (!dof_secure_session) { - dof_session = (dof_session_data *)wmem_alloc0(wmem_file_scope(), sizeof(dof_session_data)); + dof_session = wmem_new0(wmem_file_scope(), dof_session_data); dof_session->session_id = globals.next_session++; dof_session->dof_id = api_data->session->dof_id; - dof_secure_session = (dof_secure_session_data *)wmem_alloc0(wmem_file_scope(), sizeof(dof_secure_session_data)); + dof_secure_session = wmem_new0(wmem_file_scope(), dof_secure_session_data); dof_secure_session->ssid = ssid; dof_secure_session->domain_length = rekey_data->domain_length; dof_secure_session->domain = rekey_data->domain; @@ -9838,7 +9838,7 @@ static int dissect_trp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void if (identity_length == gidentity->identity_length && memcmp(identity_buf, gidentity->identity, identity_length) == 0) { - trp_pkt_data = (trp_packet_data *)wmem_alloc0(wmem_file_scope(), sizeof(trp_packet_data)); + trp_pkt_data = wmem_new0(wmem_file_scope(), trp_packet_data); dof_packet_add_proto_data(packet_data, proto_trp, trp_pkt_data); trp_pkt_data->domain_length = domain_length; @@ -10150,7 +10150,7 @@ static int dissect_trp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void if (identity_length == gidentity->identity_length && memcmp(identity_buf, gidentity->identity, identity_length) == 0) { - trp_pkt_data = (trp_packet_data *)wmem_alloc0(wmem_file_scope(), sizeof(trp_packet_data)); + trp_pkt_data = wmem_new0(wmem_file_scope(), trp_packet_data); dof_packet_add_proto_data(packet_data, proto_trp, trp_pkt_data); trp_pkt_data->domain_length = domain_length; @@ -10243,7 +10243,7 @@ static int dissect_trp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void if (identity_length == gidentity->identity_length && memcmp(identity_buf, gidentity->identity, identity_length) == 0) { - trp_pk_data = (trp_packet_data *)wmem_alloc0(wmem_file_scope(), sizeof(trp_packet_data)); + trp_pk_data = wmem_new0(wmem_file_scope(), trp_packet_data); dof_packet_add_proto_data(packet_data, proto_trp, trp_pk_data); trp_pk_data->domain_length = domain_length; diff --git a/epan/dissectors/packet-epl.c b/epan/dissectors/packet-epl.c index e529d67e92..ce2d1c2ba8 100644 --- a/epan/dissectors/packet-epl.c +++ b/epan/dissectors/packet-epl.c @@ -2354,7 +2354,7 @@ epl_duplication_insert(GHashTable* table, gpointer ptr, guint32 frame) { key = (duplication_key *)wmem_memdup(wmem_file_scope(), ptr,sizeof(duplication_key)); /* create memory */ - data = (duplication_data *)wmem_alloc0(wmem_file_scope(), sizeof(duplication_data)); + data = wmem_new0(wmem_file_scope(), duplication_data); data->frame = frame; g_hash_table_insert(table,(gpointer)key, data); } diff --git a/epan/dissectors/packet-gtp.c b/epan/dissectors/packet-gtp.c index 582126841b..5b7959d3b9 100644 --- a/epan/dissectors/packet-gtp.c +++ b/epan/dissectors/packet-gtp.c @@ -9211,7 +9211,7 @@ dissect_gtp_common(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) /* No. Attach that information to the conversation, and add * it to the list of information structures. */ - gtp_info = (gtp_conv_info_t *)wmem_alloc(wmem_file_scope(), sizeof(gtp_conv_info_t)); + gtp_info = wmem_new(wmem_file_scope(), gtp_conv_info_t); /*Request/response matching tables*/ gtp_info->matched = g_hash_table_new(gtp_sn_hash, gtp_sn_equal_matched); gtp_info->unmatched = g_hash_table_new(gtp_sn_hash, gtp_sn_equal_unmatched); diff --git a/epan/dissectors/packet-gvcp.c b/epan/dissectors/packet-gvcp.c index da564d8835..ffb1fb7a88 100644 --- a/epan/dissectors/packet-gvcp.c +++ b/epan/dissectors/packet-gvcp.c @@ -2587,7 +2587,7 @@ static int dissect_gvcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if (!gvcp_info) { gint stream_channel_count = 0; - gvcp_info = (gvcp_conv_info_t*)wmem_alloc(wmem_file_scope(), sizeof(gvcp_conv_info_t)); + gvcp_info = wmem_new(wmem_file_scope(), gvcp_conv_info_t); gvcp_info->pdus = wmem_map_new(wmem_file_scope(), g_direct_hash, g_direct_equal); for (; stream_channel_count < GVCP_MAX_STREAM_CHANNEL_COUNT; stream_channel_count++) { @@ -2601,7 +2601,7 @@ static int dissect_gvcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if (key_code == 0x42) { /* This is a request */ - gvcp_trans = (gvcp_transaction_t*)wmem_alloc(wmem_packet_scope(), sizeof(gvcp_transaction_t)); + gvcp_trans = wmem_new(wmem_packet_scope(), gvcp_transaction_t); gvcp_trans->req_frame = pinfo->num; gvcp_trans->rep_frame = 0; gvcp_trans->addr_list = 0; diff --git a/epan/dissectors/packet-hislip.c b/epan/dissectors/packet-hislip.c index 2caab292c5..22f5eaa447 100644 --- a/epan/dissectors/packet-hislip.c +++ b/epan/dissectors/packet-hislip.c @@ -772,7 +772,7 @@ dissect_hislip_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void if(!PINFO_FD_VISITED(pinfo)) { /* This is a new request */ - hislip_trans = (hislip_transaction_t *)wmem_alloc(wmem_file_scope(), sizeof(hislip_transaction_t)); + hislip_trans = wmem_new(wmem_file_scope(), hislip_transaction_t); hislip_trans->req_frame = pinfo->num; hislip_trans->rep_frame = 0; hislip_trans->messagetype = hislip_data.messagetype; diff --git a/epan/dissectors/packet-http.c b/epan/dissectors/packet-http.c index fa8c0a9849..603bb9d23e 100644 --- a/epan/dissectors/packet-http.c +++ b/epan/dissectors/packet-http.c @@ -963,7 +963,7 @@ get_http_conversation_data(packet_info *pinfo, conversation_t **conversation) conv_data = (http_conv_t *)conversation_get_proto_data(*conversation, proto_http); if(!conv_data) { /* Setup the conversation structure itself */ - conv_data = (http_conv_t *)wmem_alloc0(wmem_file_scope(), sizeof(http_conv_t)); + conv_data = wmem_new0(wmem_file_scope(), http_conv_t); conversation_add_proto_data(*conversation, proto_http, conv_data); @@ -978,7 +978,7 @@ get_http_conversation_data(packet_info *pinfo, conversation_t **conversation) */ static http_req_res_t* push_req_res(http_conv_t *conv_data) { - http_req_res_t *req_res = (http_req_res_t *)wmem_alloc0(wmem_file_scope(), sizeof(http_req_res_t)); + http_req_res_t *req_res = wmem_new0(wmem_file_scope(), http_req_res_t); nstime_set_unset(&(req_res->req_ts)); req_res->number = ++conv_data->req_res_num; diff --git a/epan/dissectors/packet-isup.c b/epan/dissectors/packet-isup.c index c524373cd2..4dcb0979ef 100644 --- a/epan/dissectors/packet-isup.c +++ b/epan/dissectors/packet-isup.c @@ -9644,7 +9644,7 @@ dissect_ansi_isup_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree offset += MESSAGE_TYPE_LENGTH; - tap_rec = (isup_tap_rec_t *)wmem_alloc(wmem_packet_scope(), sizeof(isup_tap_rec_t)); + tap_rec = wmem_new(wmem_packet_scope(), isup_tap_rec_t); tap_rec->message_type = message_type; tap_rec->calling_number = NULL; tap_rec->called_number = NULL; @@ -9945,7 +9945,7 @@ dissect_isup_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *isup offset += MESSAGE_TYPE_LENGTH; - tap_rec = (isup_tap_rec_t *)wmem_alloc(wmem_packet_scope(), sizeof(isup_tap_rec_t)); + tap_rec = wmem_new(wmem_packet_scope(), isup_tap_rec_t); tap_rec->message_type = message_type; tap_rec->calling_number = NULL; tap_rec->called_number = NULL; diff --git a/epan/dissectors/packet-iwarp-mpa.c b/epan/dissectors/packet-iwarp-mpa.c index f33ea44ef2..6da357c4c6 100644 --- a/epan/dissectors/packet-iwarp-mpa.c +++ b/epan/dissectors/packet-iwarp-mpa.c @@ -195,7 +195,7 @@ init_mpa_state(void) { mpa_state_t *state; - state = (mpa_state_t *) wmem_alloc0(wmem_file_scope(), sizeof(mpa_state_t)); + state = wmem_new0(wmem_file_scope(), mpa_state_t); state->revision = -1; return state; } diff --git a/epan/dissectors/packet-lte-rrc.c b/epan/dissectors/packet-lte-rrc.c index 24875eba97..93e5e100d5 100644 --- a/epan/dissectors/packet-lte-rrc.c +++ b/epan/dissectors/packet-lte-rrc.c @@ -13584,7 +13584,7 @@ static lte_rrc_private_data_t* lte_rrc_get_private_data(asn1_ctx_t *actx) } else { lte_rrc_private_data_t* new_struct = - (lte_rrc_private_data_t*)wmem_alloc0(wmem_packet_scope(), sizeof(lte_rrc_private_data_t)); + wmem_new0(wmem_packet_scope(), lte_rrc_private_data_t); actx->private_data = new_struct; return new_struct; } diff --git a/epan/dissectors/packet-mac-lte.c b/epan/dissectors/packet-mac-lte.c index 2a4d77b37a..e7e4a45858 100644 --- a/epan/dissectors/packet-mac-lte.c +++ b/epan/dissectors/packet-mac-lte.c @@ -7084,7 +7084,7 @@ int dissect_mac_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* d guint pdu_instance = GPOINTER_TO_UINT(data); /* Allocate and zero tap struct */ - mac_lte_tap_info *tap_info = (mac_lte_tap_info *)wmem_alloc0(wmem_file_scope(), sizeof(mac_lte_tap_info)); + mac_lte_tap_info *tap_info = wmem_new0(wmem_file_scope(), mac_lte_tap_info); /* Set protocol name */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "MAC-LTE"); diff --git a/epan/dissectors/packet-mcpe.c b/epan/dissectors/packet-mcpe.c index 2bf04baa94..cc3e76dcfc 100644 --- a/epan/dissectors/packet-mcpe.c +++ b/epan/dissectors/packet-mcpe.c @@ -136,7 +136,7 @@ mcpe_get_session_state(packet_info *pinfo) { state = (mcpe_session_state_t*)conversation_get_proto_data(conversation, proto_mcpe); if (state == NULL) { - state = (mcpe_session_state_t*)wmem_alloc(wmem_file_scope(), sizeof(mcpe_session_state_t)); + state = wmem_new(wmem_file_scope(), mcpe_session_state_t); state->encrypted = FALSE; state->encryption_starts_after = 0; diff --git a/epan/dissectors/packet-mswsp.c b/epan/dissectors/packet-mswsp.c index f0fd2650f0..a4ecc544fd 100644 --- a/epan/dissectors/packet-mswsp.c +++ b/epan/dissectors/packet-mswsp.c @@ -3669,7 +3669,7 @@ static const value_string RT_VALS[] = { {0, NULL} }; -#define EP_ALLOC(T) (T*)wmem_alloc(wmem_packet_scope(), sizeof(T)) +#define EP_ALLOC(T) wmem_new(wmem_packet_scope(), T) static int parse_rType(tvbuff_t *tvb, int offset, proto_tree *tree, enum rType *rtype, const char **str) { diff --git a/epan/dissectors/packet-mtp2.c b/epan/dissectors/packet-mtp2.c index edc6f87bcc..794f832fff 100644 --- a/epan/dissectors/packet-mtp2.c +++ b/epan/dissectors/packet-mtp2.c @@ -560,7 +560,7 @@ new_byte(char full_byte, guint8 **data, guint8 *data_len) if ((*data_len) == 0) { /* if data was never stored in this buffer before */ - *data = (guint8 *)wmem_alloc(wmem_packet_scope(), sizeof(guint8)); + *data = wmem_new(wmem_packet_scope(), guint8); (**data) = full_byte; (*data_len)++; } else { @@ -629,7 +629,7 @@ prepare_data_for_found_packet(tvbuff_t *tvb, guint8 unalignment_offset) { mtp2_recognized_packet_t *packet; - packet = (mtp2_recognized_packet_t *)wmem_alloc(wmem_packet_scope(), sizeof(mtp2_recognized_packet_t)); + packet = wmem_new(wmem_packet_scope(), mtp2_recognized_packet_t); /* store values */ packet->data = tvb; packet->unalignment_offset = unalignment_offset; @@ -663,7 +663,7 @@ dissect_mtp2_tvb(tvbuff_t* tvb, mtp2_mtp2_flag_search_t back_mtp2_flag_search, g mtp2_dissect_tvb_res_t *result = NULL; /* the result structure */ /* initialize the result structure, this will be returned at the end */ - result = (mtp2_dissect_tvb_res_t *)wmem_alloc(wmem_packet_scope(), sizeof(mtp2_dissect_tvb_res_t)); + result = wmem_new(wmem_packet_scope(), mtp2_dissect_tvb_res_t); result->mtp2_remain_data.before_first_flag = NULL; result->mtp2_remain_data.before_fh_unalignment_offset = 0; result->mtp2_remain_data.before_fh_frame_reset = FALSE; @@ -953,13 +953,13 @@ dissect_mtp2_bitstream(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void /* there is no proto data in the conversation */ if (conversation_get_proto_data(conversation, proto_mtp2) == NULL) { /* create a new convo data and fill it with initial data */ - convo_data = (mtp2_convo_data_t *) wmem_alloc(wmem_file_scope(), sizeof(mtp2_convo_data_t)); + convo_data = wmem_new(wmem_file_scope(), mtp2_convo_data_t); copy_address_wmem(wmem_file_scope(), &convo_data->addr_a, &pinfo->src); copy_address_wmem(wmem_file_scope(), &convo_data->addr_b, &pinfo->dst); convo_data->port_a = pinfo->srcport; convo_data->port_b = pinfo->destport; - convo_data->forward = (mtp2_convo_data_prev_packet_t *) wmem_alloc(wmem_file_scope(), sizeof(mtp2_convo_data_prev_packet_t)); - convo_data->backward = (mtp2_convo_data_prev_packet_t *) wmem_alloc(wmem_file_scope(), sizeof(mtp2_convo_data_prev_packet_t)); + convo_data->forward = wmem_new(wmem_file_scope(), mtp2_convo_data_prev_packet_t); + convo_data->backward = wmem_new(wmem_file_scope(), mtp2_convo_data_prev_packet_t); convo_data->forward->mtp2_flag_search.set = convo_data->backward->mtp2_flag_search.set= FALSE; convo_data->forward->mtp2_flag_search.mtp2_flag_search = convo_data->backward->mtp2_flag_search.mtp2_flag_search = 0x00; convo_data->forward->data_buff = convo_data->backward->data_buff = 0x00; @@ -983,7 +983,7 @@ dissect_mtp2_bitstream(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void /* if there is no per packet data -> create it */ if (mtp2_ppd == NULL) { - mtp2_ppd = (mtp2_ppd_t *) wmem_alloc(wmem_file_scope(), sizeof(mtp2_ppd_t)); + mtp2_ppd = wmem_new(wmem_file_scope(), mtp2_ppd_t); /* set the the proto_data_fields * because these are the values which we would like to see * if this packet is seen again */ diff --git a/epan/dissectors/packet-pcp.c b/epan/dissectors/packet-pcp.c index 72cfa54d0f..65d046e304 100644 --- a/epan/dissectors/packet-pcp.c +++ b/epan/dissectors/packet-pcp.c @@ -1858,7 +1858,7 @@ static int dissect_pcp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr pcp_conv_info = (pcp_conv_info_t*)conversation_get_proto_data(conversation, proto_pcp); if(pcp_conv_info == NULL) { - pcp_conv_info = (pcp_conv_info_t*)wmem_alloc(wmem_file_scope(), sizeof(pcp_conv_info_t)); + pcp_conv_info = wmem_new(wmem_file_scope(), pcp_conv_info_t); conversation_add_proto_data(conversation, proto_pcp, pcp_conv_info); pcp_conv_info->pmid_name_candidates = wmem_array_new(wmem_file_scope(), sizeof(guint8 *)); diff --git a/epan/dissectors/packet-raknet.c b/epan/dissectors/packet-raknet.c index 0f5b662a21..24daf481fb 100644 --- a/epan/dissectors/packet-raknet.c +++ b/epan/dissectors/packet-raknet.c @@ -238,7 +238,7 @@ raknet_get_session_state(packet_info *pinfo) { state = (raknet_session_state_t*)conversation_get_proto_data(conversation, proto_raknet); if (state == NULL) { - state = (raknet_session_state_t*)wmem_alloc(wmem_file_scope(), sizeof(raknet_session_state_t)); + state = wmem_new(wmem_file_scope(), raknet_session_state_t); state->use_encryption = FALSE; state->subdissector = NULL; conversation_add_proto_data(conversation, proto_raknet, state); diff --git a/epan/dissectors/packet-rpcrdma.c b/epan/dissectors/packet-rpcrdma.c index 747d7c769f..155f0f1699 100644 --- a/epan/dissectors/packet-rpcrdma.c +++ b/epan/dissectors/packet-rpcrdma.c @@ -391,7 +391,7 @@ static void add_request_info(rdma_conv_info_t *p_rdma_conv_info, packet_info *pi p_segment_info = find_segment_info(p_rdma_conv_info, gp_infiniband_info->reth_remote_key); if (p_segment_info && !pinfo->fd->visited) { /* Add request to segment */ - p_request = (request_t *)wmem_alloc(wmem_file_scope(), sizeof(request_t)); + p_request = wmem_new(wmem_file_scope(), request_t); p_request->psn = gp_infiniband_info->packet_seq_num; p_request->length = gp_infiniband_info->reth_dma_length; p_request->rbytes = 0; @@ -668,7 +668,7 @@ static void add_rdma_read_segment(wmem_array_t *p_read_list, if (p_rdma_chunk == NULL) { /* No read chunk was found so initialize a new chunk */ - p_rdma_chunk = (rdma_chunk_t *)wmem_alloc(wmem_packet_scope(), sizeof(rdma_chunk_t)); + p_rdma_chunk = wmem_new(wmem_packet_scope(), rdma_chunk_t); p_rdma_chunk->type = RDMA_READ_CHUNK; p_rdma_chunk->segments = wmem_array_new(wmem_packet_scope(), sizeof(rdma_segment_t)); /* Add read chunk to the RDMA read list */ @@ -687,7 +687,7 @@ static guint dissect_rpcrdma_read_chunk(proto_tree *read_list, rdma_segment_t *p_rdma_segment; /* Initialize read segment */ - p_rdma_segment = (rdma_segment_t *)wmem_alloc(wmem_packet_scope(), sizeof(rdma_segment_t)); + p_rdma_segment = wmem_new(wmem_packet_scope(), rdma_segment_t); position = tvb_get_ntohl(tvb, offset); p_rdma_segment->xdrpos = position; @@ -750,7 +750,7 @@ static guint dissect_rpcrdma_segment(proto_tree *write_chunk, tvbuff_t *tvb, rdma_segment_t *p_rdma_segment; /* Initialize write segment */ - p_rdma_segment = (rdma_segment_t *)wmem_alloc(wmem_packet_scope(), sizeof(rdma_segment_t)); + p_rdma_segment = wmem_new(wmem_packet_scope(), rdma_segment_t); p_rdma_segment->xdrpos = 0; /* Not used in write segments */ segment = proto_tree_add_subtree_format(write_chunk, tvb, @@ -791,7 +791,7 @@ static guint dissect_rpcrdma_write_chunk(proto_tree *write_list, tvbuff_t *tvb, offset += 4; /* Initialize write chunk */ - p_rdma_chunk = (rdma_chunk_t *)wmem_alloc(wmem_packet_scope(), sizeof(rdma_chunk_t)); + p_rdma_chunk = wmem_new(wmem_packet_scope(), rdma_chunk_t); p_rdma_chunk->type = chunk_type; p_rdma_chunk->segments = wmem_array_new(wmem_packet_scope(), sizeof(rdma_segment_t)); diff --git a/epan/dissectors/packet-rtitcp.c b/epan/dissectors/packet-rtitcp.c index f750224274..04c3fd56b1 100644 --- a/epan/dissectors/packet-rtitcp.c +++ b/epan/dissectors/packet-rtitcp.c @@ -536,7 +536,7 @@ static guint16 dissect_control_message(proto_tree *rtitcp_tree, tvbuff_t *tvb, p rtitcp_trans->req_frame = pinfo->num; rtitcp_trans->rep_frame = 0; rtitcp_trans->req_time = pinfo->abs_ts; - conversation_info_key = (guint64*)wmem_alloc0(wmem_file_scope(), sizeof(guint64)); + conversation_info_key = wmem_new0(wmem_file_scope(), guint64); *conversation_info_key = seq_num; wmem_map_insert(rtitcp_info->pdus, conversation_info_key, (void *)rtitcp_trans); } else { diff --git a/epan/dissectors/packet-rtps.c b/epan/dissectors/packet-rtps.c index 0322c3f24c..31623bcfc5 100644 --- a/epan/dissectors/packet-rtps.c +++ b/epan/dissectors/packet-rtps.c @@ -1901,7 +1901,7 @@ static void rtps_util_add_coherent_set_general_cases_case( coherent_set_info_entry = (coherent_set_info*)wmem_map_lookup(coherent_set_tracking.coherent_set_registry_map, &coherent_set_info_key); if (!coherent_set_info_entry) { - coherent_set_info_entry = (coherent_set_info*)wmem_alloc0(wmem_file_scope(), sizeof(coherent_set_info)); + coherent_set_info_entry = wmem_new0(wmem_file_scope(), coherent_set_info); coherent_set_info_entry->key = (coherent_set_key*)wmem_memdup(wmem_file_scope(), &coherent_set_info_key, sizeof(coherent_set_key)); coherent_set_info_entry->is_set = FALSE; wmem_map_insert( diff --git a/epan/dissectors/packet-s101.c b/epan/dissectors/packet-s101.c index 9cbb321909..f23c39764f 100644 --- a/epan/dissectors/packet-s101.c +++ b/epan/dissectors/packet-s101.c @@ -153,7 +153,7 @@ guint32 get_fragment_pdu_id(packet_info *pinfo) { static wmem_map_t* s101_fragment_info_hash = NULL; s101_fragment_t* new_fragment_info(packet_info *pinfo) { - s101_fragment_t* fi = (s101_fragment_t*)wmem_alloc(wmem_file_scope(), sizeof(s101_fragment_t)); + s101_fragment_t* fi = wmem_new(wmem_file_scope(), s101_fragment_t); if (NULL == fi) { return fi; } fi->id = pinfo->num; fi->offset = 0; diff --git a/epan/dissectors/packet-scylla.c b/epan/dissectors/packet-scylla.c index 71d9974fe1..1ddf816929 100644 --- a/epan/dissectors/packet-scylla.c +++ b/epan/dissectors/packet-scylla.c @@ -409,8 +409,8 @@ dissect_scylla_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da guint64 msg_id = tvb_get_letoh64(tvb, offset + SCYLLA_HEADER_MSG_ID_OFFSET); if (!PINFO_FD_VISITED(pinfo) && response_expected(verb_type)) { - guint64 *key = (guint64 *)wmem_alloc(wmem_file_scope(), sizeof(guint64)); - request_response_t *val = (request_response_t *)wmem_alloc(wmem_file_scope(), sizeof(request_response_t)); + guint64 *key = wmem_new(wmem_file_scope(), guint64); + request_response_t *val = wmem_new(wmem_file_scope(), request_response_t); *key = msg_id; val->verb_type = verb_type; val->request_frame_num = pinfo->num; diff --git a/epan/dissectors/packet-smb.c b/epan/dissectors/packet-smb.c index c354ec300d..d668d7ad8e 100644 --- a/epan/dissectors/packet-smb.c +++ b/epan/dissectors/packet-smb.c @@ -4611,7 +4611,7 @@ dissect_rename_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* save the offset/len for this transaction */ if (si->sip && !pinfo->fd->visited) { - rni = (smb_rename_saved_info_t *)wmem_alloc(wmem_file_scope(), sizeof(smb_rename_saved_info_t)); + rni = wmem_new(wmem_file_scope(), smb_rename_saved_info_t); rni->old_name = wmem_strdup(wmem_file_scope(), old_name); rni->new_name = wmem_strdup(wmem_file_scope(), new_name); @@ -5075,7 +5075,7 @@ dissect_write_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* save the offset/len for this transaction */ if (si->sip && !pinfo->fd->visited) { - rwi = (rw_info_t *)wmem_alloc(wmem_file_scope(), sizeof(rw_info_t)); + rwi = wmem_new(wmem_file_scope(), rw_info_t); rwi->offset = ofs; rwi->len = cnt; rwi->fid = fid; @@ -6316,7 +6316,7 @@ dissect_locking_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree /* store the locking data for the response */ if ((!pinfo->fd->visited) && si->sip) { - ld = (smb_locking_saved_info_t *)wmem_alloc(wmem_file_scope(), sizeof(smb_locking_saved_info_t)); + ld = wmem_new(wmem_file_scope(), smb_locking_saved_info_t); ld->type = lt; ld->oplock_level = ol; ld->num_lock = num_lock; @@ -6373,7 +6373,7 @@ dissect_locking_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree /* remember the unlock for the reply */ if (ld) { smb_lock_info_t *li; - li = (smb_lock_info_t *)wmem_alloc(wmem_file_scope(), sizeof(smb_lock_info_t)); + li = wmem_new(wmem_file_scope(), smb_lock_info_t); li->next = ld->unlocks; ld->unlocks = li; li->pid = lock_pid; @@ -6450,7 +6450,7 @@ dissect_locking_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree /* remember the lock for the reply */ if (ld) { smb_lock_info_t *li; - li = (smb_lock_info_t *)wmem_alloc(wmem_file_scope(), sizeof(smb_lock_info_t)); + li = wmem_new(wmem_file_scope(), smb_lock_info_t); li->next = ld->locks; ld->locks = li; li->pid = lock_pid; @@ -7079,7 +7079,7 @@ dissect_read_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i /* save the offset/len for this transaction */ if (si->sip && !pinfo->fd->visited) { - rwi = (rw_info_t *)wmem_alloc(wmem_file_scope(), sizeof(rw_info_t)); + rwi = wmem_new(wmem_file_scope(), rw_info_t); rwi->offset = ofs; rwi->len = maxcnt; rwi->fid = fid; @@ -7346,7 +7346,7 @@ dissect_write_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* save the offset/len for this transaction */ if (si->sip && !pinfo->fd->visited) { - rwi = (rw_info_t *)wmem_alloc(wmem_file_scope(), sizeof(rw_info_t)); + rwi = wmem_new(wmem_file_scope(), rw_info_t); rwi->offset = ofs; rwi->len = datalen; rwi->fid = fid; @@ -7718,7 +7718,7 @@ dissect_session_setup_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree if (ntlmssph && (ntlmssph->type == 3)) { smb_uid_t *smb_uid; - smb_uid = (smb_uid_t *)wmem_alloc(wmem_file_scope(), sizeof(smb_uid_t)); + smb_uid = wmem_new(wmem_file_scope(), smb_uid_t); smb_uid->logged_in = -1; smb_uid->logged_out = -1; smb_uid->domain = wmem_strdup(wmem_file_scope(), ntlmssph->domain_name); @@ -14316,7 +14316,7 @@ dissect_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, * smb_transact2_info_t * structure. */ - t2i = (smb_transact2_info_t *)wmem_alloc(wmem_file_scope(), sizeof(smb_transact2_info_t)); + t2i = wmem_new(wmem_file_scope(), smb_transact2_info_t); t2i->subcmd = subcmd; t2i->info_level = -1; t2i->resume_keys = FALSE; @@ -14465,7 +14465,7 @@ dissect_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, * Allocate a new smb_transact_info_t * structure. */ - tri = (smb_transact_info_t *)wmem_alloc(wmem_file_scope(), sizeof(smb_transact_info_t)); + tri = wmem_new(wmem_file_scope(), smb_transact_info_t); tri->subcmd = -1; tri->trans_subcmd = -1; tri->function = -1; @@ -18081,7 +18081,7 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da */ sip = (smb_saved_info_t *)g_hash_table_lookup(si->ct->unmatched, GUINT_TO_POINTER(pid_mid)); if (sip != NULL) { - new_key = (smb_saved_info_key_t *)wmem_alloc(wmem_file_scope(), sizeof(smb_saved_info_key_t)); + new_key = wmem_new(wmem_file_scope(), smb_saved_info_key_t); new_key->frame = pinfo->num; new_key->pid_mid = pid_mid; g_hash_table_insert(si->ct->matched, new_key, @@ -18208,7 +18208,7 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da or it's a continuation of a response we've seen. */ sip->frame_res = pinfo->num; - new_key = (smb_saved_info_key_t *)wmem_alloc(wmem_file_scope(), sizeof(smb_saved_info_key_t)); + new_key = wmem_new(wmem_file_scope(), smb_saved_info_key_t); new_key->frame = sip->frame_res; new_key->pid_mid = pid_mid; g_hash_table_insert(si->ct->matched, new_key, sip); @@ -18243,7 +18243,7 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da } } if (si->request) { - sip = (smb_saved_info_t *)wmem_alloc(wmem_file_scope(), sizeof(smb_saved_info_t)); + sip = wmem_new(wmem_file_scope(), smb_saved_info_t); sip->frame_req = pinfo->num; sip->frame_res = 0; sip->req_time = pinfo->abs_ts; @@ -18258,7 +18258,7 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da sip->fid = 0; sip->fid_seen_in_request = 0; g_hash_table_insert(si->ct->unmatched, GUINT_TO_POINTER(pid_mid), sip); - new_key = (smb_saved_info_key_t *)wmem_alloc(wmem_file_scope(), sizeof(smb_saved_info_key_t)); + new_key = wmem_new(wmem_file_scope(), smb_saved_info_key_t); new_key->frame = sip->frame_req; new_key->pid_mid = pid_mid; g_hash_table_insert(si->ct->matched, new_key, sip); diff --git a/epan/dissectors/packet-spdy.c b/epan/dissectors/packet-spdy.c index 99dbfecc7d..553b08107e 100644 --- a/epan/dissectors/packet-spdy.c +++ b/epan/dissectors/packet-spdy.c @@ -514,7 +514,7 @@ static void spdy_save_stream_info(spdy_conv_t *conv_data, conv_data->streams = wmem_tree_new(wmem_file_scope()); } - si = (spdy_stream_info_t *)wmem_alloc(wmem_file_scope(), sizeof(spdy_stream_info_t)); + si = wmem_new(wmem_file_scope(), spdy_stream_info_t); si->message_type = message_type; si->content_type = content_type; si->content_type_parameters = content_type_params; diff --git a/epan/dissectors/packet-tls-utils.c b/epan/dissectors/packet-tls-utils.c index 637b635695..3f7ef68a8b 100644 --- a/epan/dissectors/packet-tls-utils.c +++ b/epan/dissectors/packet-tls-utils.c @@ -3034,7 +3034,7 @@ ssl_create_decompressor(gint compression) if (compression == 0) return NULL; ssl_debug_printf("ssl_create_decompressor: compression method %d\n", compression); - decomp = (SslDecompress *)wmem_alloc(wmem_file_scope(), sizeof(SslDecompress)); + decomp = wmem_new(wmem_file_scope(), SslDecompress); decomp->compression = compression; switch (decomp->compression) { #ifdef HAVE_ZLIB @@ -3112,7 +3112,7 @@ ssl_create_flow(void) { SslFlow *flow; - flow = (SslFlow *)wmem_alloc(wmem_file_scope(), sizeof(SslFlow)); + flow = wmem_new(wmem_file_scope(), SslFlow); flow->byte_seq = 0; flow->flags = 0; flow->multisegment_pdus = wmem_tree_new(wmem_file_scope()); @@ -3146,7 +3146,7 @@ ssl_create_decoder(const SslCipherSuite *cipher_suite, gint cipher_algo, SslDecoder *dec; ssl_cipher_mode_t mode = cipher_suite->mode; - dec = (SslDecoder *)wmem_alloc0(wmem_file_scope(), sizeof(SslDecoder)); + dec = wmem_new0(wmem_file_scope(), SslDecoder); /* init mac buffer: mac storage is embedded into decoder struct to save a memory allocation and waste samo more memory*/ dec->cipher_suite=cipher_suite; diff --git a/epan/dissectors/packet-tpm20.c b/epan/dissectors/packet-tpm20.c index 76424932d1..1c40405add 100644 --- a/epan/dissectors/packet-tpm20.c +++ b/epan/dissectors/packet-tpm20.c @@ -1086,7 +1086,7 @@ dissect_tpm20(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, entry = (tpm_entry *)wmem_tree_lookup32(cmd_tree, pinfo->num); if (entry == NULL) { - entry = (tpm_entry *)wmem_alloc(wmem_file_scope(), sizeof(tpm_entry)); + entry = wmem_new(wmem_file_scope(), tpm_entry); entry->com_pnum = PNUM_UNINIT; entry->resp_type = PNUM_UNINIT; entry->command = 0; diff --git a/epan/dissectors/packet-umts_rlc.c b/epan/dissectors/packet-umts_rlc.c index 63191e0063..dac22cc06a 100644 --- a/epan/dissectors/packet-umts_rlc.c +++ b/epan/dissectors/packet-umts_rlc.c @@ -2722,14 +2722,14 @@ dissect_rlc_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data fpi = (fp_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_fp, 0); if (fpi == NULL) { /* Allocate new info struct for this frame */ - fpi = (fp_info *)wmem_alloc0(wmem_file_scope(), sizeof(fp_info)); + fpi = wmem_new0(wmem_file_scope(), fp_info); } else { fpInfoAlreadySet = TRUE; } rlci = (rlc_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_umts_rlc, 0); if (rlci == NULL) { /* Allocate new info struct for this frame */ - rlci = (rlc_info *)wmem_alloc0(wmem_file_scope(), sizeof(rlc_info)); + rlci = wmem_new0(wmem_file_scope(), rlc_info); } else { rlcInfoAlreadySet = TRUE; } diff --git a/epan/dissectors/packet-wsp.c b/epan/dissectors/packet-wsp.c index d70ed33ea0..0f53b86739 100644 --- a/epan/dissectors/packet-wsp.c +++ b/epan/dissectors/packet-wsp.c @@ -4633,7 +4633,7 @@ dissect_wsp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree *wsp_tree = NULL; wsp_info_value_t *stat_info; - stat_info = (wsp_info_value_t *)wmem_alloc(wmem_packet_scope(), sizeof(wsp_info_value_t)); + stat_info = wmem_new(wmem_packet_scope(), wsp_info_value_t); stat_info->status_code = 0; /* This field shows up as the "Info" column in the display; you should make diff --git a/plugins/epan/profinet/packet-dcerpc-pn-io.c b/plugins/epan/profinet/packet-dcerpc-pn-io.c index 4c723f2eb1..f57f702b79 100644 --- a/plugins/epan/profinet/packet-dcerpc-pn-io.c +++ b/plugins/epan/profinet/packet-dcerpc-pn-io.c @@ -2653,7 +2653,7 @@ pnio_ar_new(e_guid_t *aruuid) pnio_ar_t *ar; - ar = (pnio_ar_t *)wmem_alloc0(wmem_file_scope(), sizeof(pnio_ar_t)); + ar = wmem_new0(wmem_file_scope(), pnio_ar_t); memcpy(&ar->aruuid, aruuid, sizeof(e_guid_t)); diff --git a/plugins/epan/profinet/packet-dcom-cba-acco.c b/plugins/epan/profinet/packet-dcom-cba-acco.c index e05f6f9914..b776a605a4 100644 --- a/plugins/epan/profinet/packet-dcom-cba-acco.c +++ b/plugins/epan/profinet/packet-dcom-cba-acco.c @@ -498,7 +498,7 @@ cba_pdev_add(packet_info *pinfo, const address *addr) } /* not found, create a new */ - pdev = (cba_pdev_t *)wmem_alloc(wmem_file_scope(), sizeof(cba_pdev_t)); + pdev = wmem_new(wmem_file_scope(), cba_pdev_t); memcpy( (void *) (pdev->ip), addr->data, 4); pdev->first_packet = pinfo->num; pdev->ldevs = NULL; @@ -564,7 +564,7 @@ cba_ldev_add(packet_info *pinfo, cba_pdev_t *pdev, const char *name) } /* not found, create a new */ - ldev = (cba_ldev_t *)wmem_alloc(wmem_file_scope(), sizeof(cba_ldev_t)); + ldev = wmem_new(wmem_file_scope(), cba_ldev_t); ldev->name = wmem_strdup(wmem_file_scope(), name); ldev->first_packet = pinfo->num; ldev->ldev_object = NULL; @@ -739,7 +739,7 @@ cba_frame_connect(packet_info *pinfo, cba_ldev_t *cons_ldev, cba_ldev_t *prov_ld } } - frame = (cba_frame_t *)wmem_alloc(wmem_file_scope(), sizeof(cba_frame_t)); + frame = wmem_new(wmem_file_scope(), cba_frame_t); frame->consparent = cons_ldev; frame->provparent = prov_ldev; @@ -973,7 +973,7 @@ cba_connection_connect(packet_info *pinfo, cba_ldev_t *cons_ldev, cba_ldev_t *pr } } - conn = (cba_connection_t *)wmem_alloc(wmem_file_scope(), sizeof(cba_connection_t)); + conn = wmem_new(wmem_file_scope(), cba_connection_t); conn->consparentacco = cons_ldev; conn->provparentacco = prov_ldev; @@ -1882,7 +1882,7 @@ dissect_ICBAAccoServer_DisconnectMe_rqst(tvbuff_t *tvb, int offset, cons_ldev = cba_acco_add(pinfo, szStr); if (prov_ldev != NULL && cons_ldev != NULL) { - call = (server_disconnectme_call_t *)wmem_alloc(wmem_file_scope(), sizeof(server_disconnectme_call_t)); + call = wmem_new(wmem_file_scope(), server_disconnectme_call_t); call->cons = cons_ldev; call->prov = prov_ldev; di->call_data->private_data = call; @@ -1953,7 +1953,7 @@ dissect_ICBAAccoServerSRT_DisconnectMe_rqst(tvbuff_t *tvb, int offset, cons_ldev = cba_acco_add(pinfo, szStr); if (prov_ldev != NULL && cons_ldev != NULL) { - call = (server_disconnectme_call_t *)wmem_alloc(wmem_file_scope(), sizeof(server_disconnectme_call_t)); + call = wmem_new(wmem_file_scope(), server_disconnectme_call_t); call->cons = cons_ldev; call->prov = prov_ldev; di->call_data->private_data = call; |