FP: ensure that mac and rlc structures are always allocated

Rather han checking everywhere that the RLC and MAC info are present in pinfo,
allocate a temporary structure that will be dropped once packet dissection is
over.

Bug: 12751
Change-Id: I890430dd0c0b56d641777c15eedbf07fef082904
Reviewed-on: https://code.wireshark.org/review/17094
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
This commit is contained in:
Pascal Quantin 2016-08-16 23:11:12 +02:00
parent 5716cc6d7c
commit 315bba7c64
1 changed files with 26 additions and 3 deletions

View File

@ -2724,9 +2724,7 @@ dissect_e_dch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
ddi_ti = proto_tree_add_bits_ret_val(subframe_header_tree, hf_fp_edch_ddi, tvb,
offset*8 + bit_offset, 6, &ddi, ENC_BIG_ENDIAN);
if (rlcinf) {
rlcinf->rbid[i] = (guint8)ddi;
}
rlcinf->rbid[i] = (guint8)ddi;
/********************************/
/* Look up data in higher layers*/
/* Look up the size from this DDI value */
@ -2775,6 +2773,9 @@ dissect_e_dch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
bit_offset = 0;
macinf = (umts_mac_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_umts_mac, 0);
if (!macinf) {
macinf = wmem_new0(wmem_packet_scope(), umts_mac_info);
}
/* Add subframe subtree */
subframe_ti = proto_tree_add_string_format(tree, hf_fp_edch_subframe, tvb, offset, 0,
"", "Subframe %u data", subframes[n].subframe_number);
@ -3170,7 +3171,13 @@ dissect_hsdsch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
rlc_info *rlcinf;
rlcinf = (rlc_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_rlc, 0);
if (!rlcinf) {
rlcinf = wmem_new0(wmem_packet_scope(), rlc_info);
}
macinf = (umts_mac_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_umts_mac, 0);
if (!macinf) {
macinf = wmem_new0(wmem_packet_scope(), umts_mac_info);
}
/**************************************/
/* HS-DCH data here (type 1 in R7) */
@ -3373,7 +3380,14 @@ dissect_hsdsch_type_2_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree
rlc_info *rlcinf;
rlcinf = (rlc_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_rlc, 0);
if (!rlcinf) {
rlcinf = wmem_new0(wmem_packet_scope(), rlc_info);
}
macinf = (umts_mac_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_umts_mac, 0);
if (!macinf) {
macinf = wmem_new0(wmem_packet_scope(), umts_mac_info);
}
/********************************/
/* HS-DCH type 2 data here */
@ -3616,7 +3630,13 @@ void dissect_hsdsch_common_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto
rlc_info *rlcinf;
rlcinf = (rlc_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_rlc, 0);
if (!rlcinf) {
rlcinf = wmem_new0(wmem_packet_scope(), rlc_info);
}
macinf = (umts_mac_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_umts_mac, 0);
if (!macinf) {
macinf = wmem_new0(wmem_packet_scope(), umts_mac_info);
}
/********************************/
/* HS-DCH type 2 data here */
@ -4318,6 +4338,9 @@ dissect_fp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
}
rlcinf = (rlc_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_rlc, 0);
if (!rlcinf) {
rlcinf = wmem_new0(wmem_packet_scope(), rlc_info);
}
/* Show release information */
if (preferences_show_release_info) {