Commit 5103c14a authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Fix CPP Check

parent 2756b871
......@@ -58,29 +58,32 @@ namespace config {
//------------------------------------------------------------------------------
amf_config::amf_config() {
nrf_addr.ipv4_addr.s_addr = INADDR_ANY;
nrf_addr.port = 80;
nrf_addr.api_version = "v1";
enable_nf_registration = false;
enable_smf_selection = false;
enable_external_ausf = false;
enable_external_udm = false;
instance = 0;
n2 = {};
n11 = {};
statistics_interval = 0;
guami = {};
guami_list = {};
relativeAMFCapacity = 0;
plmn_list = {};
auth_conf auth_para = {};
nas_cfg = {};
smf_pool = {};
enable_nf_registration = false;
enable_smf_selection = false;
enable_external_ausf = false;
enable_external_udm = false;
use_fqdn_dns = false;
nrf_addr.ipv4_addr.s_addr = INADDR_ANY;
nrf_addr.port = 80;
nrf_addr.api_version = "v1";
ausf_addr.ipv4_addr.s_addr = INADDR_ANY;
ausf_addr.port = 80;
ausf_addr.api_version = "v1";
enable_nf_registration = false;
enable_smf_selection = false;
enable_external_ausf = false;
enable_external_udm = false;
instance = 0;
n2 = {};
n11 = {};
statistics_interval = 0;
guami = {};
guami_list = {};
relativeAMFCapacity = 0;
plmn_list = {};
auth_conf auth_para = {};
nas_cfg = {};
smf_pool = {};
enable_nf_registration = false;
enable_smf_selection = false;
enable_external_ausf = false;
enable_external_udm = false;
use_fqdn_dns = false;
struct {
struct in_addr ipv4_addr;
......
......@@ -1291,7 +1291,7 @@ bool amf_n1::get_authentication_vectors_from_ausf(
Logger::amf_n1().debug("********* has auts *********");
char* auts_s = (char*) malloc(auts_len * 2 + 1);
// char *rand_s = (char *)malloc(RAND_LENGTH * 2 + 1);
memset(auts_s, 0, sizeof(auts_s));
memset(auts_s, 0, auts_len * 2);
// memset(rand_s, 0, sizeof(rand_s));
// uint8_t rand_value[RAND_LENGTH];
......
......@@ -64,6 +64,7 @@ nas_context::nas_context() : _vector(), _5g_he_av(), _5g_av(), kamf() {
is_auth_vectors_present = false;
to_be_register_by_new_suci = false;
ueSecurityCaplen = 0;
nas_status = {};
}
//------------------------------------------------------------------------------
......
......@@ -44,6 +44,7 @@ pdu_session_context::pdu_session_context() {
smf_available = false;
snssai = {};
plmn = {};
is_ho_accepted = false;
}
//------------------------------------------------------------------------------
......
......@@ -133,7 +133,7 @@ int _5GSMobilityIdentity::_5g_s_tmsi_encode2buffer(uint8_t* buf, int len) {
//------------------------------------------------------------------------------
int _5GSMobilityIdentity::_5g_s_tmsi_decodefrombuffer(uint8_t* buf, int len) {
int decoded_size = 0;
_5g_s_tmsi = (_5G_S_TMSI_t*) calloc(1, sizeof(_5G_S_TMSI_t));
if (!_5g_s_tmsi) _5g_s_tmsi = (_5G_S_TMSI_t*) calloc(1, sizeof(_5G_S_TMSI_t));
decoded_size++; // type of identity
uint8_t octet = *(buf + decoded_size);
decoded_size++;
......
......@@ -36,6 +36,8 @@ UESecurityCapability::UESecurityCapability(uint8_t iei) {
_iei = iei;
_5g_EASel = 0;
_5g_IASel = 0;
EEASel = 0;
EIASel = 0;
length = 0;
}
......@@ -44,6 +46,8 @@ UESecurityCapability::UESecurityCapability() {
_iei = 0;
_5g_EASel = 0;
_5g_IASel = 0;
EEASel = 0;
EIASel = 0;
length = 0;
}
......
......@@ -94,7 +94,7 @@ bool PDUSessionResourceHandoverRequiredTransfer::decodefromIE(
bool PDUSessionResourceHandoverRequiredTransfer::
getDirectForwardingPathAvailability(
long* directForwardingPathAvailability) {
directForwardingPathAvailability = (long*) DirectForwardingPathAvailability;
*directForwardingPathAvailability = (long) *DirectForwardingPathAvailability;
return true;
}
......
......@@ -34,7 +34,9 @@ using namespace std;
namespace ngap {
//------------------------------------------------------------------------------
PacketLossRate::PacketLossRate() {}
PacketLossRate::PacketLossRate() {
packetlossrate = 0;
}
//------------------------------------------------------------------------------
PacketLossRate::~PacketLossRate() {}
......
......@@ -89,9 +89,11 @@ bool SecurityIndication::encode2SecurityIndication(
//------------------------------------------------------------------------------
bool SecurityIndication::decodefromSecurityIndication(
Ngap_SecurityIndication_t* securityIndication) {
integrityProtectionIndication = new IntegrityProtectionIndication();
confidentialityProtectionIndication =
new ConfidentialityProtectionIndication();
if (!integrityProtectionIndication)
integrityProtectionIndication = new IntegrityProtectionIndication();
if (!confidentialityProtectionIndication)
confidentialityProtectionIndication =
new ConfidentialityProtectionIndication();
if (!integrityProtectionIndication->decodefromIntegrityProtectionIndication(
securityIndication->integrityProtectionIndication))
......
......@@ -70,7 +70,7 @@ bool ServedGUAMIItem::encode2ServedGUAMIItem(
//------------------------------------------------------------------------------
bool ServedGUAMIItem::decodefromServedGUAMIItem(Ngap_ServedGUAMIItem* pdu) {
guamiGroup = new GUAMI();
if (!guamiGroup) guamiGroup = new GUAMI();
if (!guamiGroup->decodefromGUAMI(&pdu->gUAMI)) return false;
if (pdu->backupAMFName) {
backupAMFNameIsSet = true;
......
......@@ -105,7 +105,7 @@ bool UEAssociationLogicalNGConnectionItem::encode(
//------------------------------------------------------------------------------
bool UEAssociationLogicalNGConnectionItem::decode(
Ngap_UE_associatedLogicalNG_connectionItem_t* item) {
amfUeNgapId = new AMF_UE_NGAP_ID();
if (!amfUeNgapId) amfUeNgapId = new AMF_UE_NGAP_ID();
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(*item->aMF_UE_NGAP_ID)) {
cout << "Decoded NGAP AMF_UE_NGAP_ID IE error" << endl;
return false;
......
......@@ -24,6 +24,11 @@
#include <iostream>
#include <vector>
using namespace std;
extern "C" {
#include "dynamic_memory_check.h"
}
namespace ngap {
dRBSubjectList::dRBSubjectList() {
drbsubjectitem = nullptr;
......@@ -46,7 +51,10 @@ bool dRBSubjectList::encodefromdRBSubjectlist(
1, sizeof(Ngap_DRBsSubjectToStatusTransferItem_t));
if (!ie) return false;
if (!drbsubjectitem) return false;
if (!drbsubjectitem) {
free_wrapper((void**) &ie);
return false;
}
if (!drbsubjectitem[i].encodedRBSubjectItem(ie)) {
cout << "encodefromdRBSubjectlist error" << endl;
return false;
......
......@@ -104,7 +104,7 @@ void DownlinkRANStatusTransfer::setRANStatusTransfer_TransparentContainer(
new RANStatusTransferTransparentContainer();
}
Ngap_DRB_ID_t* dRB_id = (Ngap_DRB_ID_t*) calloc(1, sizeof(Ngap_DRB_ID_t));
dRB_id = &drb_id;
*dRB_id = drb_id;
COUNTValueForPDCP_SN18* UL_value =
(COUNTValueForPDCP_SN18*) calloc(1, sizeof(COUNTValueForPDCP_SN18));
UL_value->setvalue(ul_pcdp, ul_hfn_pdcp);
......
......@@ -45,6 +45,7 @@ HandoverPreparationFailure::HandoverPreparationFailure() {
ranUeNgapId = nullptr;
cause = nullptr;
hoPreparationFailureIEs = nullptr;
hoPreparationFailurePdu = nullptr;
CriticalityDiagnostics = nullptr;
}
......
......@@ -53,6 +53,7 @@ PduSessionResourceSetupRequestMsg::PduSessionResourceSetupRequestMsg() {
nasPdu = nullptr;
pduSessionResourceSetupRequestList = nullptr;
uEAggregateMaxBitRate = nullptr;
pduSessionAggregateMaximumBitRate = nullptr;
}
//------------------------------------------------------------------------------
......@@ -78,6 +79,7 @@ void PduSessionResourceSetupRequestMsg::setUEAggregateMaxBitRate(
ie->value.choice.UEAggregateMaximumBitRate);
if (!ret) {
Logger::ngap().error("Encode NGAP UEAggregateMaxBitRate IE error");
free_wrapper((void**) &ie);
return;
}
......
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