Commit 4146a48a authored by aligungr's avatar aligungr

NTS memory leak fix

parent 4ec4a785
...@@ -153,9 +153,9 @@ static PdcpPduNumberExtHeader *DecodePdcpPduNumberExtHeader(int len, const Octet ...@@ -153,9 +153,9 @@ static PdcpPduNumberExtHeader *DecodePdcpPduNumberExtHeader(int len, const Octet
return res; return res;
} }
GtpMessage *DecodeGtpMessage(const OctetView &stream) std::unique_ptr<GtpMessage> DecodeGtpMessage(const OctetView &stream)
{ {
auto *res = new GtpMessage(); auto res = std::make_unique<GtpMessage>();
size_t fistIndex = stream.currentIndex(); size_t fistIndex = stream.currentIndex();
......
...@@ -39,12 +39,12 @@ struct PduSessionInformation ...@@ -39,12 +39,12 @@ struct PduSessionInformation
struct DlPduSessionInformation : PduSessionInformation struct DlPduSessionInformation : PduSessionInformation
{ {
bool qmp{}; // (Mandatory) QoS Monitoring Packet, See 5.5.3.8 bool qmp{}; // (Mandatory) QoS Monitoring Packet, See 5.5.3.8
int qfi{}; // (Mandatory) 6-bit, QOS Flow Identifier, See 5.5.3.3 int qfi{}; // (Mandatory) 6-bit, QOS Flow Identifier, See 5.5.3.3
bool rqi{}; // (Mandatory) Reflective QOS Indicator, See 5.5.3.4 bool rqi{}; // (Mandatory) Reflective QOS Indicator, See 5.5.3.4
std::optional<int> ppi{}; // (Optional, may be null) Paging Policy Indicator, See 5.5.3.7 std::optional<int> ppi{}; // (Optional, may be null) Paging Policy Indicator, See 5.5.3.7
std::optional<int64_t> dlSendingTs{}; // (Optional, may be null) DL Sending Time Stamp, See 5.5.3.9 std::optional<int64_t> dlSendingTs{}; // (Optional, may be null) DL Sending Time Stamp, See 5.5.3.9
std::optional<int> dlQfiSeq{}; // (Optional, may be null) 3-octet, DL QFI Sequence Number, See 5.5.3.18 std::optional<int> dlQfiSeq{}; // (Optional, may be null) 3-octet, DL QFI Sequence Number, See 5.5.3.18
DlPduSessionInformation() : PduSessionInformation(PDU_TYPE_DL) DlPduSessionInformation() : PduSessionInformation(PDU_TYPE_DL)
{ {
...@@ -55,14 +55,15 @@ struct DlPduSessionInformation : PduSessionInformation ...@@ -55,14 +55,15 @@ struct DlPduSessionInformation : PduSessionInformation
struct UlPduSessionInformation : PduSessionInformation struct UlPduSessionInformation : PduSessionInformation
{ {
bool qmp{}; // (Mandatory) QoS Monitoring Packet, See 5.5.3.8 bool qmp{}; // (Mandatory) QoS Monitoring Packet, See 5.5.3.8
int qfi{}; // (Mandatory) 6-bit, QOS Flow Identifier, See 5.5.3.3 int qfi{}; // (Mandatory) 6-bit, QOS Flow Identifier, See 5.5.3.3
std::optional<int64_t> dlSendingTsRepeated{}; // (Optional, may be null) DL Sending Time Stamp Repeated, See 5.5.3.10 std::optional<int64_t>
std::optional<int64_t> dlReceivedTs{}; // (Optional, may be null) DL Received Time Stamp, See 5.5.3.11 dlSendingTsRepeated{}; // (Optional, may be null) DL Sending Time Stamp Repeated, See 5.5.3.10
std::optional<int64_t> ulSendingTs{}; // (Optional, may be null) UL Sending Time Stamp, See 5.5.3.12 std::optional<int64_t> dlReceivedTs{}; // (Optional, may be null) DL Received Time Stamp, See 5.5.3.11
std::optional<uint32_t> dlDelayResult{}; // (Optional, may be null) DL Delay Result, See 5.5.3.14 std::optional<int64_t> ulSendingTs{}; // (Optional, may be null) UL Sending Time Stamp, See 5.5.3.12
std::optional<uint32_t> ulDelayResult{}; // (Optional, may be null) UL Delay Result, See 5.5.3.16 std::optional<uint32_t> dlDelayResult{}; // (Optional, may be null) DL Delay Result, See 5.5.3.14
std::optional<int> ulQfiSeq{}; // (Optional, may be null) 3-octet, UL QFI Sequence Number, See 5.5.3.19 std::optional<uint32_t> ulDelayResult{}; // (Optional, may be null) UL Delay Result, See 5.5.3.16
std::optional<int> ulQfiSeq{}; // (Optional, may be null) 3-octet, UL QFI Sequence Number, See 5.5.3.19
UlPduSessionInformation() : PduSessionInformation(PDU_TYPE_UL) UlPduSessionInformation() : PduSessionInformation(PDU_TYPE_UL)
{ {
...@@ -151,6 +152,6 @@ struct GtpMessage ...@@ -151,6 +152,6 @@ struct GtpMessage
}; };
bool EncodeGtpMessage(const GtpMessage &msg, OctetString &stream); bool EncodeGtpMessage(const GtpMessage &msg, OctetString &stream);
GtpMessage *DecodeGtpMessage(const OctetView &stream); std::unique_ptr<GtpMessage> DecodeGtpMessage(const OctetView &stream);
} // namespace gtp } // namespace gtp
...@@ -222,20 +222,18 @@ void GtpTask::handleUplinkData(int ueId, int psi, OctetString &&pdu) ...@@ -222,20 +222,18 @@ void GtpTask::handleUplinkData(int ueId, int psi, OctetString &&pdu)
void GtpTask::handleUdpReceive(const udp::NwUdpServerReceive &msg) void GtpTask::handleUdpReceive(const udp::NwUdpServerReceive &msg)
{ {
OctetView buffer{msg.packet}; OctetView buffer{msg.packet};
auto *gtp = gtp::DecodeGtpMessage(buffer); auto gtp = gtp::DecodeGtpMessage(buffer);
auto sessionInd = m_sessionTree.findByDownTeid(gtp->teid); auto sessionInd = m_sessionTree.findByDownTeid(gtp->teid);
if (sessionInd == 0) if (sessionInd == 0)
{ {
m_logger->err("TEID %d not found on GTP-U Downlink", gtp->teid); m_logger->err("TEID %d not found on GTP-U Downlink", gtp->teid);
delete gtp;
return; return;
} }
if (gtp->msgType != gtp::GtpMessage::MT_G_PDU) if (gtp->msgType != gtp::GtpMessage::MT_G_PDU)
{ {
m_logger->err("Unhandled GTP-U message type: %d", gtp->msgType); m_logger->err("Unhandled GTP-U message type: %d", gtp->msgType);
delete gtp;
return; return;
} }
...@@ -247,8 +245,6 @@ void GtpTask::handleUdpReceive(const udp::NwUdpServerReceive &msg) ...@@ -247,8 +245,6 @@ void GtpTask::handleUdpReceive(const udp::NwUdpServerReceive &msg)
w->pdu = std::move(gtp->payload); w->pdu = std::move(gtp->payload);
m_base->rlsTask->push(std::move(w)); m_base->rlsTask->push(std::move(w));
} }
delete gtp;
} }
void GtpTask::updateAmbrForUe(int ueId) void GtpTask::updateAmbrForUe(int ueId)
......
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