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
+9 -2
View File
@@ -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);
+2 -2
View File
@@ -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
}