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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user