diff --git a/src/internet/model/udp-socket-impl.cc b/src/internet/model/udp-socket-impl.cc index ab6895d4d..464a96d68 100644 --- a/src/internet/model/udp-socket-impl.cc +++ b/src/internet/model/udp-socket-impl.cc @@ -247,6 +247,11 @@ UdpSocketImpl::Bind (const Address &address) { m_endPoint = m_udp->Allocate (ipv4, port); } + if (0 == m_endPoint) + { + m_errno = port ? ERROR_ADDRINUSE : ERROR_ADDRNOTAVAIL; + return -1; + } } else if (Inet6SocketAddress::IsMatchingType (address)) { @@ -269,6 +274,11 @@ UdpSocketImpl::Bind (const Address &address) { m_endPoint6 = m_udp->Allocate6 (ipv6, port); } + if (0 == m_endPoint6) + { + m_errno = port ? ERROR_ADDRINUSE : ERROR_ADDRNOTAVAIL; + return -1; + } } else {