Fixed uninitialized sock

master
Ismael Gomez 7 years ago
parent a0e5d7f011
commit be62b8a179

@ -591,7 +591,7 @@ int main(int argc, char *argv[])
int setup_if_addr(char *ip_addr) int setup_if_addr(char *ip_addr)
{ {
char *dev = (char*) "tun_srsenb"; char *dev = (char*) "tun_srsenb";
int sock; int sock = -1;
// Construct the TUN device // Construct the TUN device
int tun_fd = open("/dev/net/tun", O_RDWR); int tun_fd = open("/dev/net/tun", O_RDWR);
@ -647,7 +647,11 @@ int setup_if_addr(char *ip_addr)
return(tun_fd); return(tun_fd);
clean_exit: clean_exit:
if (sock != -1) {
shutdown(sock, SHUT_RDWR); shutdown(sock, SHUT_RDWR);
}
if (tun_fd != -1) {
close(tun_fd); close(tun_fd);
}
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }

Loading…
Cancel
Save