Commit 19d83ad2 authored by Robert Schmidt's avatar Robert Schmidt

Make GTPV1U REQ in one allocation to avoid mem leak at GTP

parent 51a7b7bd
...@@ -197,18 +197,20 @@ static void nr_sdap_rx_entity(nr_sdap_entity_t *entity, ...@@ -197,18 +197,20 @@ static void nr_sdap_rx_entity(nr_sdap_entity_t *entity,
} }
// Pushing SDAP SDU to GTP-U Layer // Pushing SDAP SDU to GTP-U Layer
MessageDef *message_p; MessageDef *message_p = itti_alloc_new_message_sized(TASK_PDCP_ENB,
uint8_t *gtpu_buffer_p; 0,
gtpu_buffer_p = itti_malloc(TASK_PDCP_ENB, TASK_GTPV1_U, size + GTPU_HEADER_OVERHEAD_MAX - offset); GTPV1U_GNB_TUNNEL_DATA_REQ,
AssertFatal(gtpu_buffer_p != NULL, "OUT OF MEMORY"); sizeof(gtpv1u_gnb_tunnel_data_req_t)
memcpy(&gtpu_buffer_p[GTPU_HEADER_OVERHEAD_MAX], buf+offset, size-offset); + size + GTPU_HEADER_OVERHEAD_MAX - offset);
message_p = itti_alloc_new_message(TASK_PDCP_ENB, 0 , GTPV1U_GNB_TUNNEL_DATA_REQ);
AssertFatal(message_p != NULL, "OUT OF MEMORY"); AssertFatal(message_p != NULL, "OUT OF MEMORY");
GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).buffer = gtpu_buffer_p; gtpv1u_gnb_tunnel_data_req_t *req = &GTPV1U_GNB_TUNNEL_DATA_REQ(message_p);
GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).length = size-offset; uint8_t *gtpu_buffer_p = (uint8_t *) (req + 1);
GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).offset = GTPU_HEADER_OVERHEAD_MAX; memcpy(gtpu_buffer_p + GTPU_HEADER_OVERHEAD_MAX, buf + offset, size - offset);
GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).rnti = rnti; req->buffer = gtpu_buffer_p;
GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).pdusession_id = pdusession_id; req->length = size - offset;
req->offset = GTPU_HEADER_OVERHEAD_MAX;
req->rnti = rnti;
req->pdusession_id = pdusession_id;
LOG_D(SDAP, "%s() sending message to gtp size %d\n", __func__, size-offset); LOG_D(SDAP, "%s() sending message to gtp size %d\n", __func__, size-offset);
itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p); itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p);
} else { //nrUE } else { //nrUE
......
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