more coverity fixes

This commit is contained in:
Andre Puschmann 2018-02-02 09:43:10 +01:00
parent 07cd9ae528
commit e5a04844ec
2 changed files with 4 additions and 1 deletions

View File

@ -82,6 +82,7 @@ bool read(std::string filename) {
written[thread][msg] = true;
} else {
perror("Wrong thread and/or msg");
fclose(f);
return false;
}
}

View File

@ -591,7 +591,7 @@ int main(int argc, char *argv[])
int setup_if_addr(char *ip_addr)
{
char *dev = (char*) "tun_srsenb";
int sock = 0;
int sock;
// Construct the TUN device
int tun_fd = open("/dev/net/tun", O_RDWR);
@ -642,10 +642,12 @@ int setup_if_addr(char *ip_addr)
perror("ioctl");
goto clean_exit;
}
shutdown(sock, SHUT_RDWR);
return(tun_fd);
clean_exit:
shutdown(sock, SHUT_RDWR);
close(tun_fd);
return SRSLTE_ERROR;
}