Commit 7bc0d097 authored by aligungr's avatar aligungr

NTS memory leak fix

parent 1a4e2296
......@@ -112,8 +112,8 @@ void GnbRrcTask::triggerSysInfoBroadcast()
auto *mib = ConstructMibMessage(m_isBarred, m_intraFreqReselectAllowed);
auto *sib1 = ConstructSib1Message(m_cellReserved, m_config->tac, m_config->nci, m_config->plmn, m_aiBarringSet);
sendRrcMessage(*mib);
sendRrcMessage(*sib1);
sendRrcMessage(mib);
sendRrcMessage(sib1);
asn::Free(asn_DEF_ASN_RRC_BCCH_BCH_Message, mib);
asn::Free(asn_DEF_ASN_RRC_BCCH_DL_SCH_Message, sib1);
......
......@@ -65,7 +65,7 @@ void GnbRrcTask::handleUplinkRrc(int ueId, rrc::RrcChannel channel, const OctetS
}
}
void GnbRrcTask::sendRrcMessage(const ASN_RRC_BCCH_BCH_Message &msg)
void GnbRrcTask::sendRrcMessage(ASN_RRC_BCCH_BCH_Message *msg)
{
OctetString pdu = rrc::encode::EncodeS(asn_DEF_ASN_RRC_BCCH_BCH_Message, msg);
if (pdu.length() == 0)
......@@ -81,7 +81,7 @@ void GnbRrcTask::sendRrcMessage(const ASN_RRC_BCCH_BCH_Message &msg)
m_base->rlsTask->push(std::move(w));
}
void GnbRrcTask::sendRrcMessage(const ASN_RRC_BCCH_DL_SCH_Message &msg)
void GnbRrcTask::sendRrcMessage(ASN_RRC_BCCH_DL_SCH_Message *msg)
{
OctetString pdu = rrc::encode::EncodeS(asn_DEF_ASN_RRC_BCCH_DL_SCH_Message, msg);
if (pdu.length() == 0)
......@@ -97,7 +97,7 @@ void GnbRrcTask::sendRrcMessage(const ASN_RRC_BCCH_DL_SCH_Message &msg)
m_base->rlsTask->push(std::move(w));
}
void GnbRrcTask::sendRrcMessage(int ueId, const ASN_RRC_DL_CCCH_Message &msg)
void GnbRrcTask::sendRrcMessage(int ueId, ASN_RRC_DL_CCCH_Message *msg)
{
OctetString pdu = rrc::encode::EncodeS(asn_DEF_ASN_RRC_DL_CCCH_Message, msg);
if (pdu.length() == 0)
......@@ -113,7 +113,7 @@ void GnbRrcTask::sendRrcMessage(int ueId, const ASN_RRC_DL_CCCH_Message &msg)
m_base->rlsTask->push(std::move(w));
}
void GnbRrcTask::sendRrcMessage(int ueId, const ASN_RRC_DL_DCCH_Message &msg)
void GnbRrcTask::sendRrcMessage(int ueId, ASN_RRC_DL_DCCH_Message *msg)
{
OctetString pdu = rrc::encode::EncodeS(asn_DEF_ASN_RRC_DL_DCCH_Message, msg);
if (pdu.length() == 0)
......@@ -129,7 +129,7 @@ void GnbRrcTask::sendRrcMessage(int ueId, const ASN_RRC_DL_DCCH_Message &msg)
m_base->rlsTask->push(std::move(w));
}
void GnbRrcTask::sendRrcMessage(const ASN_RRC_PCCH_Message &msg)
void GnbRrcTask::sendRrcMessage(ASN_RRC_PCCH_Message *msg)
{
OctetString pdu = rrc::encode::EncodeS(asn_DEF_ASN_RRC_PCCH_Message, msg);
if (pdu.length() == 0)
......
......@@ -88,7 +88,7 @@ void GnbRrcTask::receiveRrcSetupRequest(int ueId, const ASN_RRC_RRCSetupRequest
m_logger->info("RRC Setup for UE[%d]", ueId);
sendRrcMessage(ueId, *pdu);
sendRrcMessage(ueId, pdu);
asn::Free(asn_DEF_ASN_RRC_DL_CCCH_Message, pdu);
}
......
......@@ -54,7 +54,7 @@ void GnbRrcTask::handleDownlinkNasDelivery(int ueId, const OctetString &nasPdu)
c1.choice.dlInformationTransfer->dedicatedNAS_Message = asn::New<ASN_RRC_DedicatedNAS_Message_t>();
asn::SetOctetString(*c1.choice.dlInformationTransfer->dedicatedNAS_Message, nasPdu);
sendRrcMessage(ueId, *pdu);
sendRrcMessage(ueId, pdu);
asn::Free(asn_DEF_ASN_RRC_DL_DCCH_Message, pdu);
}
......@@ -87,7 +87,7 @@ void GnbRrcTask::releaseConnection(int ueId)
rrcRelease->criticalExtensions.present = ASN_RRC_RRCRelease__criticalExtensions_PR_rrcRelease;
rrcRelease->criticalExtensions.choice.rrcRelease = asn::New<ASN_RRC_RRCRelease_IEs>();
sendRrcMessage(ueId, *pdu);
sendRrcMessage(ueId, pdu);
asn::Free(asn_DEF_ASN_RRC_DL_DCCH_Message, pdu);
// Delete UE RRC context
......@@ -130,7 +130,7 @@ void GnbRrcTask::handlePaging(const asn::Unique<ASN_NGAP_FiveG_S_TMSI> &tmsi,
paging->pagingRecordList = asn::NewFor(paging->pagingRecordList);
asn::SequenceAdd(*paging->pagingRecordList, record);
sendRrcMessage(*pdu);
sendRrcMessage(pdu);
asn::Free(asn_DEF_ASN_RRC_PCCH_Message, pdu);
}
......
......@@ -80,11 +80,11 @@ class GnbRrcTask : public NtsTask
void receiveUplinkInformationTransfer(int ueId, const ASN_RRC_ULInformationTransfer &msg);
/* RRC channel send message */
void sendRrcMessage(const ASN_RRC_BCCH_BCH_Message &msg);
void sendRrcMessage(const ASN_RRC_BCCH_DL_SCH_Message &msg);
void sendRrcMessage(int ueId, const ASN_RRC_DL_CCCH_Message &msg);
void sendRrcMessage(int ueId, const ASN_RRC_DL_DCCH_Message &msg);
void sendRrcMessage(const ASN_RRC_PCCH_Message &msg);
void sendRrcMessage(ASN_RRC_BCCH_BCH_Message *msg);
void sendRrcMessage(ASN_RRC_BCCH_DL_SCH_Message *msg);
void sendRrcMessage(int ueId, ASN_RRC_DL_CCCH_Message *msg);
void sendRrcMessage(int ueId, ASN_RRC_DL_DCCH_Message *msg);
void sendRrcMessage(ASN_RRC_PCCH_Message *msg);
/* RRC channel receive message */
void receiveRrcMessage(int ueId, ASN_RRC_BCCH_BCH_Message *msg);
......
......@@ -24,9 +24,9 @@ namespace rrc::encode
{
template <typename T>
inline bool Encode(const asn_TYPE_descriptor_t &desc, const T &pdu, ssize_t &encoded, uint8_t *&buffer)
inline bool Encode(const asn_TYPE_descriptor_t &desc, T *pdu, ssize_t &encoded, uint8_t *&buffer)
{
auto res = asn_encode_to_new_buffer(nullptr, ATS_UNALIGNED_CANONICAL_PER, &desc, &pdu);
auto res = asn_encode_to_new_buffer(nullptr, ATS_UNALIGNED_CANONICAL_PER, &desc, pdu);
if (res.buffer == nullptr || res.result.encoded < 0)
return false;
......@@ -38,7 +38,7 @@ inline bool Encode(const asn_TYPE_descriptor_t &desc, const T &pdu, ssize_t &enc
}
template <typename T>
inline OctetString EncodeS(const asn_TYPE_descriptor_t &desc, const T &pdu)
inline OctetString EncodeS(const asn_TYPE_descriptor_t &desc, T *pdu)
{
uint8_t *buffer;
ssize_t encoded;
......
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