From e5a04844ec295b435c7a1ec249f0824ca07fb0ed Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Fri, 2 Feb 2018 09:43:10 +0100 Subject: [PATCH] more coverity fixes --- lib/test/common/logger_test.cc | 1 + srsenb/test/upper/ip_test.cc | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/test/common/logger_test.cc b/lib/test/common/logger_test.cc index 1e0d86b50..895db4e77 100644 --- a/lib/test/common/logger_test.cc +++ b/lib/test/common/logger_test.cc @@ -82,6 +82,7 @@ bool read(std::string filename) { written[thread][msg] = true; } else { perror("Wrong thread and/or msg"); + fclose(f); return false; } } diff --git a/srsenb/test/upper/ip_test.cc b/srsenb/test/upper/ip_test.cc index deceb486e..820974b4d 100644 --- a/srsenb/test/upper/ip_test.cc +++ b/srsenb/test/upper/ip_test.cc @@ -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; }