src/internet/model/tcp-socket-base.cc
changeset 7441 bf446d9feecc
parent 7440 979d65377d5f
child 7608 de67936e4017
--- a/src/internet/model/tcp-socket-base.cc	Wed Aug 17 11:39:16 2011 -0400
+++ b/src/internet/model/tcp-socket-base.cc	Wed Aug 17 12:23:54 2011 -0400
@@ -219,6 +219,11 @@
 {
   NS_LOG_FUNCTION_NOARGS ();
   m_endPoint = m_tcp->Allocate ();
+  if (0 == m_endPoint)
+    {
+      m_errno = ERROR_ADDRNOTAVAIL;
+      return -1;
+    }
   return SetupCallback ();
 }
 
@@ -238,6 +243,11 @@
   if (ipv4 == Ipv4Address::GetAny () && port == 0)
     {
       m_endPoint = m_tcp->Allocate ();
+      if (0 == m_endPoint)
+        {
+	  m_errno = ERROR_ADDRNOTAVAIL;
+          return -1;
+	}
     }
   else if (ipv4 == Ipv4Address::GetAny () && port != 0)
     {
@@ -251,6 +261,11 @@
   else if (ipv4 != Ipv4Address::GetAny () && port == 0)
     {
       m_endPoint = m_tcp->Allocate (ipv4);
+      if (0 == m_endPoint)
+        {
+	  m_errno = ERROR_ADDRNOTAVAIL;
+	  return -1;
+        }
     }
   else if (ipv4 != Ipv4Address::GetAny () && port != 0)
     {