Skip to content

Commit

Permalink
Coverity found a "leaked" file descriptor in mod_snmp; we were not re…
Browse files Browse the repository at this point in the history
…turning

the opened socket to the caller when opening the listening socket.
  • Loading branch information
tjsaunders committed Oct 11, 2014
1 parent b74ee50 commit f020025
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion contrib/mod_snmp/mod_snmp.c
Expand Up @@ -1492,6 +1492,7 @@ static int snmp_agent_listen(pr_netaddr_t *agent_addr) {
family == AF_INET ? "IPv4" : "IPv6",
pr_netaddr_get_ipstr(agent_addr),
ntohs(pr_netaddr_get_port(agent_addr)), strerror(errno));
(void) close(sockfd);
exit(1);

} else {
Expand All @@ -1501,7 +1502,7 @@ static int snmp_agent_listen(pr_netaddr_t *agent_addr) {
ntohs(pr_netaddr_get_port(agent_addr)));
}

return 0;
return sockfd;
}

static void snmp_agent_loop(array_header *sockfds, array_header *addrs) {
Expand Down

0 comments on commit f020025

Please sign in to comment.