Fix Coverity Scan CID 342010

Fix a few cppcheck errors/warnings

Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
This commit is contained in:
Raphael Defosseux
2019-07-05 11:03:30 +02:00
parent d2a6cca8f9
commit 3f2acf9485
5 changed files with 20 additions and 10 deletions
@@ -267,7 +267,7 @@ int nas_message_decrypt(
{
LOG_FUNC_IN;
emm_security_context_t *emm_security_context = (emm_security_context_t*)security;
emm_security_context_t *emm_security_context = NULL;
int bytes = length;
/* Decode the header */
@@ -277,7 +277,8 @@ int nas_message_decrypt(
LOG_TRACE(DEBUG, "MESSAGE TOO SHORT");
LOG_FUNC_RETURN (TLV_DECODE_BUFFER_TOO_SHORT);
} else if (size > 1) {
if (emm_security_context) {
if (security) {
emm_security_context = (emm_security_context_t*)security;
#if defined(NAS_MME)
if (emm_security_context->ul_count.seq_num > header->sequence_number) {
@@ -376,7 +377,7 @@ int nas_message_decode(
void *security)
{
LOG_FUNC_IN;
emm_security_context_t *emm_security_context = (emm_security_context_t*)security;
emm_security_context_t *emm_security_context = NULL;
int bytes;
/* Decode the header */
@@ -385,7 +386,8 @@ int nas_message_decode(
if (size < 0) {
LOG_FUNC_RETURN (TLV_DECODE_BUFFER_TOO_SHORT);
} else if (size > 1) {
if (emm_security_context) {
if (security) {
emm_security_context = (emm_security_context_t*)security;
#if defined(NAS_MME)
if (emm_security_context->ul_count.seq_num > msg->header.sequence_number) {
@@ -971,6 +973,8 @@ static int _nas_message_decrypt(
#else
direction = SECU_DIRECTION_DOWNLINK;
#endif
if (emm_security_context == NULL)
LOG_FUNC_RETURN (0);
switch (security_header_type) {
case SECURITY_HEADER_TYPE_NOT_PROTECTED: