Commit 14b7311b authored by Guido Casati's avatar Guido Casati

Fix memory leak in do_NR_ULInformationTransfer

* buffer is allocated but not freed after use by PDCP

> Direct leak of 192 byte(s) in 3 object(s) allocated from:
    > 0 0x7ffff74b4c38 in __interceptor_realloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:164
    > 1 0x55555775ee74 in encode_dyn_cb /cmake_targets/ran_build/build/openair2/RRC/LTE/MESSAGES/per_encoder.c:23
    > 2 0x55555774776e in _uper_encode_flush_outp /cmake_targets/ran_build/build/openair2/RRC/LTE/MESSAGES/uper_encoder.c:126
    > 3 0x55555774776e in uper_encode /cmake_targets/ran_build/build/openair2/RRC/LTE/MESSAGES/uper_encoder.c:36
    > 4 0x555557747c91 in uper_encode_to_new_buffer /cmake_targets/ran_build/build/openair2/RRC/LTE/MESSAGES/uper_encoder.c:85
    > 5 0x5555576c5172 in do_NR_ULInformationTransfer /openair2/RRC/NR/MESSAGES/asn1_msg.c:965
    > 6 0x555556fba691 in rrc_nrue /openair2/RRC/NR_UE/rrc_UE.c:1819
    > 7 0x555556fc4d2e in rrc_nrue_task /openair2/RRC/NR_UE/rrc_UE.c:1717
    > 8 0x7ffff5e94ac2 in start_thread nptl/pthread_create.c:442
parent aa8cf7c4
......@@ -1814,7 +1814,7 @@ void *rrc_nrue(void *notUsed)
case NAS_UPLINK_DATA_REQ: {
uint32_t length;
uint8_t *buffer;
uint8_t *buffer = NULL;
NasUlDataReq *req = &NAS_UPLINK_DATA_REQ(msg_p);
/* Create message for PDCP (ULInformationTransfer_t) */
length = do_NR_ULInformationTransfer(&buffer, req->nasMsg.length, req->nasMsg.data);
......@@ -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(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