From 3d2b32ac1e158499a2bad875d2710814e384e59b Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Tue, 6 Aug 2024 16:26:17 +0200 Subject: [PATCH] Fix direct leak of memory allocate by deliver_sdu_srb with itti_malloc * The RRC task is freeing the ITTI message but the message members that are allocated separetely still need to be freed > Direct leak of 470 byte(s) in 6 object(s) allocated from: >0 0x7ffff74b4a57 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154 >1 0x55555721f117 in itti_malloc /common/utils/ocp_itti/intertask_interface.cpp:64 >2 0x555556f2356c in deliver_sdu_srb /openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c:775 >3 0x555556f4e10e in nr_pdcp_entity_recv_pdu /openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c:184 >4 0x555556f278ad in do_pdcp_data_ind /openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c:285 >5 0x555556f278ad in pdcp_data_ind_thread /openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c:307 >6 0x7ffff5e94ac2 in start_thread nptl/pthread_create.c:442 --- openair2/RRC/NR_UE/rrc_UE.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index e77ddefcd9..49cdb39ec9 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -1793,6 +1793,9 @@ void *rrc_nrue(void *notUsed) NR_RRC_DCCH_DATA_IND(msg_p).sdu_size, NR_RRC_DCCH_DATA_IND(msg_p).gNB_index, &NR_RRC_DCCH_DATA_IND(msg_p).msg_integrity); + /* this is allocated by itti_malloc in PDCP task (deliver_sdu_srb) + then passed to the RRC task and freed after use */ + free(NR_RRC_DCCH_DATA_IND(msg_p).sdu_p); break; case NAS_KENB_REFRESH_REQ: