From 969c1c0271bf71cb14ea2a9658c844891f937f84 Mon Sep 17 00:00:00 2001 From: Moshe Kaplan Date: Sat, 26 Dec 2020 21:54:52 -0500 Subject: [PATCH] packet-rrc: allocate correct type of object When creating a `flowd_p`, instead of allocating space for a `gint`, allocate space for a `guint`, which is the actual type of object used. Also, switch from `g_malloc` to `g_new`. --- epan/dissectors/asn1/rrc/rrc.cnf | 6 +++--- epan/dissectors/packet-rrc.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/epan/dissectors/asn1/rrc/rrc.cnf b/epan/dissectors/asn1/rrc/rrc.cnf index 927b5c04a7..2a3d6d170f 100644 --- a/epan/dissectors/asn1/rrc/rrc.cnf +++ b/epan/dissectors/asn1/rrc/rrc.cnf @@ -1377,7 +1377,7 @@ if(state_dec >= 0 && state_dec <= 3) { /*If it doesn't exists, insert it*/ if( (cur_val=(gint *)g_tree_lookup(hsdsch_muxed_flows, GUINT_TO_POINTER((guint)rrcinf->hrnti[actx->pinfo->fd->subnum]))) == NULL ){ - flowd_p = (guint*)g_malloc0(sizeof(gint)); + flowd_p = g_new0(guint, 1); *flowd_p = (1U<hrnti[actx->pinfo->fd->subnum]), flowd_p); @@ -1413,7 +1413,7 @@ if(state_dec >= 0 && state_dec <= 3) { /*If it doesn't exists, insert it*/ if( (cur_val=(gint *)g_tree_lookup(hsdsch_muxed_flows, GUINT_TO_POINTER((guint)rrcinf->hrnti[actx->pinfo->fd->subnum]))) == NULL ){ - flowd_p = (guint*)g_malloc0(sizeof(gint)); + flowd_p = g_new0(guint, 1); *flowd_p = (1U<hrnti[actx->pinfo->fd->subnum]), flowd_p); @@ -1740,4 +1740,4 @@ private_data_set_rlc_ciphering_sqn(actx, rlc_ciphering_sqn); col_append_str(actx->pinfo->cinfo, COL_INFO, "Scheduling Block 3"); %(DEFAULT_BODY)s -#.END \ No newline at end of file +#.END diff --git a/epan/dissectors/packet-rrc.c b/epan/dissectors/packet-rrc.c index b19c789a62..29e4e6f693 100644 --- a/epan/dissectors/packet-rrc.c +++ b/epan/dissectors/packet-rrc.c @@ -46484,7 +46484,7 @@ dissect_rrc_DL_TransportChannelType_r5(tvbuff_t *tvb _U_, int offset _U_, asn1_c /*If it doesn't exists, insert it*/ if( (cur_val=(gint *)g_tree_lookup(hsdsch_muxed_flows, GUINT_TO_POINTER((guint)rrcinf->hrnti[actx->pinfo->fd->subnum]))) == NULL ){ - flowd_p = (guint*)g_malloc0(sizeof(gint)); + flowd_p = g_new0(guint, 1); *flowd_p = (1U<hrnti[actx->pinfo->fd->subnum]), flowd_p); @@ -49959,7 +49959,7 @@ dissect_rrc_DL_TransportChannelType_r7(tvbuff_t *tvb _U_, int offset _U_, asn1_c /*If it doesn't exists, insert it*/ if( (cur_val=(gint *)g_tree_lookup(hsdsch_muxed_flows, GUINT_TO_POINTER((guint)rrcinf->hrnti[actx->pinfo->fd->subnum]))) == NULL ){ - flowd_p = (guint*)g_malloc0(sizeof(gint)); + flowd_p = g_new0(guint, 1); *flowd_p = (1U<hrnti[actx->pinfo->fd->subnum]), flowd_p);