summaryrefslogtreecommitdiff
path: root/src/socket.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-02 00:46:21 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-02 00:46:21 +0000
commite581679d1fe4af527fd9e456569266271144b4ce (patch)
tree8b53c66d133f9fc15f6c8b6feebae617f89ec3a5 /src/socket.cpp
parentb31f343eacdf248aebd6869f2190a3464fd5d555 (diff)
Fix valgrind uninitialised memory error
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11612 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/socket.cpp')
-rw-r--r--src/socket.cpp5
1 files changed, 1 insertions, 4 deletions
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
}