From 4fd82f4bcbc5f677865b7fb18009dde99a6e8506 Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Thu, 7 Jun 2018 16:28:26 +0100 Subject: [PATCH] some allocated buffers in the s1ap were not being correctly deallocated. sctp_sendmsg() blocks until the buffer is written to the socket, so it is ok to deallocate the buffer right after this call. --- srsenb/src/upper/s1ap.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/srsenb/src/upper/s1ap.cc b/srsenb/src/upper/s1ap.cc index 6eafe5030..b7fe331ab 100644 --- a/srsenb/src/upper/s1ap.cc +++ b/srsenb/src/upper/s1ap.cc @@ -896,6 +896,9 @@ bool s1ap::send_initial_ctxt_setup_response(uint16_t rnti, LIBLTE_S1AP_MESSAGE_I ssize_t n_sent = sctp_sendmsg(socket_fd, buf->msg, buf->N_bytes, (struct sockaddr*)&mme_addr, sizeof(struct sockaddr_in), htonl(PPID), 0, ue_ctxt_map[rnti].stream_id, 0, 0); + + pool->deallocate(buf); + if(n_sent == -1) { s1ap_log->error("Failed to send InitialContextSetupResponse for RNTI:0x%x\n", rnti); return false; @@ -947,6 +950,9 @@ bool s1ap::send_erab_setup_response(uint16_t rnti, LIBLTE_S1AP_MESSAGE_E_RABSETU ssize_t n_sent = sctp_sendmsg(socket_fd, buf->msg, buf->N_bytes, (struct sockaddr*)&mme_addr, sizeof(struct sockaddr_in), htonl(PPID), 0, ue_ctxt_map[rnti].stream_id, 0, 0); + + pool->deallocate(buf); + if(n_sent == -1) { s1ap_log->error("Failed to send E_RABSetupResponse for RNTI:0x%x\n", rnti); return false; @@ -992,6 +998,9 @@ bool s1ap::send_initial_ctxt_setup_failure(uint16_t rnti) ssize_t n_sent = sctp_sendmsg(socket_fd, buf->msg, buf->N_bytes, (struct sockaddr*)&mme_addr, sizeof(struct sockaddr_in), htonl(PPID), 0, ue_ctxt_map[rnti].stream_id, 0, 0); + + pool->deallocate(buf); + if(n_sent == -1) { s1ap_log->error("Failed to send UplinkNASTransport for RNTI:0x%x\n", rnti); return false;