From e581679d1fe4af527fd9e456569266271144b4ce Mon Sep 17 00:00:00 2001 From: danieldg Date: Wed, 2 Sep 2009 00:46:21 +0000 Subject: Fix valgrind uninitialised memory error git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11612 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/socket.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src') diff --git a/src/socket.cpp b/src/socket.cpp index c426f16e6..c4f8baee6 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -36,14 +36,13 @@ bool InspIRCd::BindSocket(int sockfd, int port, const char* addr, bool dolisten) } else { + memset(&servaddr, 0, sizeof(servaddr)); if (port == -1) { /* Port -1: Means UDP IPV4 port binding - Special case * used by DNS engine. */ servaddr.in4.sin_family = AF_INET; - servaddr.in4.sin_addr.s_addr = htonl(INADDR_ANY); - servaddr.in4.sin_port = 0; } else { @@ -52,11 +51,9 @@ bool InspIRCd::BindSocket(int sockfd, int port, const char* addr, bool dolisten) /* Default to ipv6 bind to all */ servaddr.in6.sin6_family = AF_INET6; servaddr.in6.sin6_port = htons(port); - memset(&servaddr.in6.sin6_addr, 0, sizeof(servaddr.in6.sin6_addr)); #else /* Bind ipv4 to all */ servaddr.in4.sin_family = AF_INET; - servaddr.in4.sin_addr.s_addr = htonl(INADDR_ANY); servaddr.in4.sin_port = htons(port); #endif } -- cgit v1.2.3