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