Commit 0a7254ba authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Fix CppCheck

parent 126c8d46
...@@ -2161,6 +2161,7 @@ bool amf_n1::start_security_mode_control_procedure( ...@@ -2161,6 +2161,7 @@ bool amf_n1::start_security_mode_control_procedure(
} }
if (!secu_ctx) { if (!secu_ctx) {
Logger::amf_n1().error("No Security Context found"); Logger::amf_n1().error("No Security Context found");
free_wrapper((void**) &data);
return false; return false;
} }
......
...@@ -172,6 +172,7 @@ void conv::convert_string_2_hex( ...@@ -172,6 +172,7 @@ void conv::convert_string_2_hex(
sprintf(datahex + i * 2, "%02x", data[i]); sprintf(datahex + i * 2, "%02x", data[i]);
output_str = reinterpret_cast<char*>(datahex); output_str = reinterpret_cast<char*>(datahex);
free_wrapper((void**) &datahex);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
...@@ -64,6 +64,7 @@ nas_context::nas_context() : _vector(), _5g_he_av(), _5g_av(), kamf() { ...@@ -64,6 +64,7 @@ nas_context::nas_context() : _vector(), _5g_he_av(), _5g_av(), kamf() {
is_auth_vectors_present = false; is_auth_vectors_present = false;
to_be_register_by_new_suci = false; to_be_register_by_new_suci = false;
ueSecurityCaplen = 0; ueSecurityCaplen = 0;
registration_request_is_set = false;
nas_status = CM_IDLE; nas_status = CM_IDLE;
is_mobile_reachable_timer_timeout = false; is_mobile_reachable_timer_timeout = false;
mobile_reachable_timer = ITTI_INVALID_TIMER_ID; mobile_reachable_timer = ITTI_INVALID_TIMER_ID;
......
...@@ -43,6 +43,7 @@ Payload_Container::Payload_Container(uint8_t iei, bstring b) { ...@@ -43,6 +43,7 @@ Payload_Container::Payload_Container(uint8_t iei, bstring b) {
_iei = iei; _iei = iei;
content = b; content = b;
CONTENT = {}; CONTENT = {};
length = 1 + blength(b);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -66,6 +67,7 @@ Payload_Container::Payload_Container( ...@@ -66,6 +67,7 @@ Payload_Container::Payload_Container(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Payload_Container::Payload_Container() : content() { Payload_Container::Payload_Container() : content() {
_iei = 0; _iei = 0;
length = 0;
CONTENT = {}; CONTENT = {};
} }
......
...@@ -60,6 +60,8 @@ UESecurityCapability::UESecurityCapability( ...@@ -60,6 +60,8 @@ UESecurityCapability::UESecurityCapability(
_iei = iei; _iei = iei;
_5g_EASel = _5gg_EASel; _5g_EASel = _5gg_EASel;
_5g_IASel = _5gg_IASel; _5g_IASel = _5gg_IASel;
EEASel = 0;
EIASel = 0;
length = 2; length = 2;
} }
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
*/ */
#include "AssociatedQosFlowList.hpp" #include "AssociatedQosFlowList.hpp"
#include "dynamic_memory_check.h"
#include <iostream> #include <iostream>
using namespace std; using namespace std;
...@@ -65,12 +66,20 @@ bool AssociatedQosFlowList::encode2AssociatedQosFlowList( ...@@ -65,12 +66,20 @@ bool AssociatedQosFlowList::encode2AssociatedQosFlowList(
Ngap_AssociatedQosFlowItem_t* ie = (Ngap_AssociatedQosFlowItem_t*) calloc( Ngap_AssociatedQosFlowItem_t* ie = (Ngap_AssociatedQosFlowItem_t*) calloc(
1, sizeof(Ngap_AssociatedQosFlowItem_t)); 1, sizeof(Ngap_AssociatedQosFlowItem_t));
if (!ie) return false; if (!ie) return false;
if (!associatedQosFlowItem) return false; if (!associatedQosFlowItem) {
if (!associatedQosFlowItem[i].encode2AssociatedQosFlowItem(ie)) free_wrapper((void**) &ie);
return false; return false;
if (ASN_SEQUENCE_ADD(&associatedQosFlowList.list, ie) != 0) return false;
} }
if (!associatedQosFlowItem[i].encode2AssociatedQosFlowItem(ie)) {
free_wrapper((void**) &ie);
return false;
}
if (ASN_SEQUENCE_ADD(&associatedQosFlowList.list, ie) != 0) {
free_wrapper((void**) &ie);
return false;
}
free_wrapper((void**) &ie);
}
return true; return true;
} }
......
...@@ -36,6 +36,7 @@ namespace ngap { ...@@ -36,6 +36,7 @@ namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
PDUSessionResourceModifyItemModReq::PDUSessionResourceModifyItemModReq() { PDUSessionResourceModifyItemModReq::PDUSessionResourceModifyItemModReq() {
nAS_PDU = nullptr; nAS_PDU = nullptr;
s_NSSAI = nullptr;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
...@@ -27,6 +27,10 @@ ...@@ -27,6 +27,10 @@
*/ */
#include "PDUSessionResourceSetupItemCxtReq.hpp" #include "PDUSessionResourceSetupItemCxtReq.hpp"
//#include "dynamic_memory_check.h"
extern "C" {
#include "dynamic_memory_check.h"
}
#include <iostream> #include <iostream>
using namespace std; using namespace std;
...@@ -70,7 +74,7 @@ bool PDUSessionResourceSetupItemCxtReq:: ...@@ -70,7 +74,7 @@ bool PDUSessionResourceSetupItemCxtReq::
(Ngap_NAS_PDU_t*) calloc(1, sizeof(Ngap_NAS_PDU_t)); (Ngap_NAS_PDU_t*) calloc(1, sizeof(Ngap_NAS_PDU_t));
if (!naspdu) return false; if (!naspdu) return false;
if (!nAS_PDU->encode2octetstring(*naspdu)) { if (!nAS_PDU->encode2octetstring(*naspdu)) {
if (naspdu != nullptr) free(naspdu); free_wrapper((void**) &naspdu);
return false; return false;
} }
pduSessionResourceSetupItemCxtReq->nAS_PDU = naspdu; pduSessionResourceSetupItemCxtReq->nAS_PDU = naspdu;
......
...@@ -27,6 +27,9 @@ ...@@ -27,6 +27,9 @@
*/ */
#include "ResetType.hpp" #include "ResetType.hpp"
extern "C" {
#include "dynamic_memory_check.h"
}
#include <iostream> #include <iostream>
using namespace std; using namespace std;
...@@ -58,6 +61,7 @@ void ResetType::setResetType( ...@@ -58,6 +61,7 @@ void ResetType::setResetType(
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
item[i].encode(list[i]); item[i].encode(list[i]);
} }
free_wrapper((void**) &item);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool ResetType::encode(Ngap_ResetType_t* type) { bool ResetType::encode(Ngap_ResetType_t* type) {
......
...@@ -56,9 +56,9 @@ void UEAssociationLogicalNGConnectionItem::setAmfUeNgapId(unsigned long id) { ...@@ -56,9 +56,9 @@ void UEAssociationLogicalNGConnectionItem::setAmfUeNgapId(unsigned long id) {
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID); int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
if (!ret) { if (!ret) {
cout << "encode AMF_UE_NGAP_ID IE error" << endl; cout << "encode AMF_UE_NGAP_ID IE error" << endl;
}
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
}
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -77,9 +77,9 @@ void UEAssociationLogicalNGConnectionItem::setRanUeNgapId( ...@@ -77,9 +77,9 @@ void UEAssociationLogicalNGConnectionItem::setRanUeNgapId(
int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID); int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID);
if (!ret) { if (!ret) {
cout << "Encode RAN_UE_NGAP_ID IE error" << endl; cout << "Encode RAN_UE_NGAP_ID IE error" << endl;
}
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; 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