Commit 3f2acf94 authored by Raphael Defosseux's avatar Raphael Defosseux
Browse files

Fix Coverity Scan CID 342010


Fix a few cppcheck errors/warnings
Signed-off-by: Raphael Defosseux's avatarRaphael Defosseux <raphael.defosseux@eurecom.fr>
parent d2a6cca8
......@@ -826,7 +826,6 @@ int flexran_agent_mac_stats_reply(mid_t mod_id,
}
}
free(ue_report);
ue_report = NULL;
}
return -1;
......
......@@ -235,7 +235,7 @@ rlc_am_receive_process_control_pdu(
rlc_sn_t ack_sn = RLC_AM_NEXT_SN(rlc_pP->vt_a);
rlc_sn_t sn_cursor = rlc_pP->vt_a;
rlc_sn_t vt_a_new = rlc_pP->vt_a;
rlc_sn_t sn_data_cnf;
rlc_sn_t sn_data_cnf = (rlc_sn_t) 0;
rlc_sn_t nack_sn,prev_nack_sn;
sdu_size_t data_cnf_so_stop = 0x7FFF;
unsigned int nack_index;
......
......@@ -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:
......
......@@ -125,8 +125,15 @@ int main(int argc, char *argv[]) {
fullwrite(serviceSock, &header, sizeof(header));
int dataSize=sizeof(sample_t)*header.size*header.nbAnt;
if (dataSize>bufSize)
buff=realloc(buff,dataSize);
if (dataSize>bufSize) {
void * new_buff = realloc(buff, dataSize);
if (new_buff == NULL) {
free(buff);
AssertFatal(1, "Could not reallocate");
} else {
buff = new_buff;
}
}
AssertFatal(read(fd,buff,dataSize) == dataSize, "");
fullwrite(serviceSock, buff, dataSize);
......
......@@ -508,9 +508,9 @@ int wakeup_txfh(PHY_VARS_eNB *eNB, L1_rxtx_proc_t *proc,int frame_tx,int subfram
if (((fp->frame_type == TDD) && (subframe_select(fp,proc->subframe_tx)==SF_UL))||
(eNB->RU_list[ru_id]->state == RU_SYNC)||
(eNB->RU_list[ru_id]->wait_cnt>0)){
AssertFatal((pthread_mutex_lock(&proc->mutex_RUs))==0, "mutex_lock returns %d\n",ret);
AssertFatal((ret=pthread_mutex_lock(&proc->mutex_RUs))==0, "mutex_lock returns %d\n",ret);
proc->instance_cnt_RUs = 0;
AssertFatal((pthread_mutex_unlock(&proc->mutex_RUs))==0, "mutex_unlock returns %d\n",ret);
AssertFatal((ret=pthread_mutex_unlock(&proc->mutex_RUs))==0, "mutex_unlock returns %d\n",ret);
continue;//hacking only works when all RU_tx works on the same subframe #TODO: adding mask stuff
}
......
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