From 132d7a38edd738828e7dcca84eebb52f8fa054f1 Mon Sep 17 00:00:00 2001 From: aligungr Date: Fri, 24 Dec 2021 14:29:18 +0300 Subject: [PATCH] NAS/RRC memory leak fix --- src/lib/nas/base.hpp | 1 + src/lib/nas/msg.hpp | 3 +++ src/ue/rrc/connection.cpp | 1 + src/ue/rrc/nas.cpp | 1 + 4 files changed, 6 insertions(+) diff --git a/src/lib/nas/base.hpp b/src/lib/nas/base.hpp index a00d2b8b4..13c44425b 100644 --- a/src/lib/nas/base.hpp +++ b/src/lib/nas/base.hpp @@ -16,6 +16,7 @@ namespace nas struct InformationElement { + virtual ~InformationElement() = default; }; struct InformationElement1 : InformationElement diff --git a/src/lib/nas/msg.hpp b/src/lib/nas/msg.hpp index 9aa6ec16f..77a182bb8 100644 --- a/src/lib/nas/msg.hpp +++ b/src/lib/nas/msg.hpp @@ -83,6 +83,9 @@ struct NasMessage protected: NasMessage() = default; + + public: + virtual ~NasMessage() = default; }; struct SmMessage : NasMessage diff --git a/src/ue/rrc/connection.cpp b/src/ue/rrc/connection.cpp index 3d0e282b6..7da7f573e 100644 --- a/src/ue/rrc/connection.cpp +++ b/src/ue/rrc/connection.cpp @@ -126,6 +126,7 @@ void UeRrcTask::receiveRrcSetup(int cellId, const ASN_RRC_RRCSetup &msg) m_initialNasPdu = {}; sendRrcMessage(pdu); + asn::Free(asn_DEF_ASN_RRC_UL_DCCH_Message, pdu); m_logger->info("RRC connection established"); switchState(ERrcState::RRC_CONNECTED); diff --git a/src/ue/rrc/nas.cpp b/src/ue/rrc/nas.cpp index b04cbbb8c..61c670f9d 100644 --- a/src/ue/rrc/nas.cpp +++ b/src/ue/rrc/nas.cpp @@ -57,6 +57,7 @@ void UeRrcTask::deliverUplinkNas(uint32_t pduId, OctetString &&nasPdu) asn::SetOctetString(*c1.choice.ulInformationTransfer->dedicatedNAS_Message, nasPdu); sendRrcMessage(pdu); + asn::Free(asn_DEF_ASN_RRC_UL_DCCH_Message, pdu); } void UeRrcTask::receiveDownlinkInformationTransfer(const ASN_RRC_DLInformationTransfer &msg)