Commit 0ef6153b authored by Guido Casati's avatar Guido Casati

Fix memory leak of NAS buffer transfered to RRC with NAS_UPLINK_DATA_REQ

* Data buffer for NAS Registration Complete and Authentication Response is malloced in
  the NAS thread and transfered with ITTI message to RRC, where needs to be freed

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    >0 0x7ffff74b4887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    >1 0x5555572b0607 in generateAuthenticationResp /repo/openairinterface5g/develop/openair3/NAS/NR_UE/nr_nas_msg_sim.c:608
    >2 0x5555572b0607 in nas_nrue /repo/openairinterface5g/develop/openair3/NAS/NR_UE/nr_nas_msg_sim.c:1402
    >3 0x5555572baef6 in nas_nrue_task /repo/openairinterface5g/develop/openair3/NAS/NR_UE/nr_nas_msg_sim.c:1198
    >4 0x7ffff5e94ac2 in start_thread nptl/pthread_create.c:442

Direct leak of 10 byte(s) in 1 object(s) allocated from:
    >0 0x7ffff74b4887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    >1 0x55555729754e in generateRegistrationComplete /repo/openairinterface5g/develop/openair3/NAS/NR_UE/nr_nas_msg_sim.c:782
    >2 0x555557299ad3 in handle_registration_accept /repo/openairinterface5g/develop/openair3/NAS/NR_UE/nr_nas_msg_sim.c:1212
    >3 0x5555572b06a0 in nas_nrue /repo/openairinterface5g/develop/openair3/NAS/NR_UE/nr_nas_msg_sim.c:1411
    >4 0x5555572baef6 in nas_nrue_task /repo/openairinterface5g/develop/openair3/NAS/NR_UE/nr_nas_msg_sim.c:1198
    >5 0x7ffff5e94ac2 in start_thread nptl/pthread_create.c:442
parent 46a1d2a6
......@@ -1823,6 +1823,7 @@ void *rrc_nrue(void *notUsed)
// error: the remote gNB is hardcoded here
rb_id_t srb_id = rrc->Srb[2] == RB_ESTABLISHED ? 2 : 1;
nr_pdcp_data_req_srb(rrc->ue_id, srb_id, 0, length, buffer, deliver_pdu_srb_rlc, NULL);
free(req->nasMsg.data);
free(buffer);
break;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment