--- a/RELEASE_NOTES Wed Jan 15 10:12:52 2014 -0800
+++ b/RELEASE_NOTES Wed Jan 15 23:35:55 2014 +0100
@@ -29,6 +29,7 @@
Bugs fixed
----------
+- Bug 1739 - The endpoint is not deallocated for UDP sockets
- Bug 1786 - os << int64x64_t prints un-normalized fractional values
- Bug 1821 - Setting an interface to Down state will cause various asserts in IPv6
- Bug 1837 - AODV crashes when using multiple interfaces
--- a/src/internet/model/tcp-socket-base.h Wed Jan 15 10:12:52 2014 -0800
+++ b/src/internet/model/tcp-socket-base.h Wed Jan 15 23:35:55 2014 +0100
@@ -341,7 +341,7 @@
void Destroy6 (void);
/**
- * \brief Deallocate m_endPoint
+ * \brief Deallocate m_endPoint and m_endPoint6
*/
void DeallocateEndPoint (void);
--- a/src/internet/model/udp-socket-impl.cc Wed Jan 15 10:12:52 2014 -0800
+++ b/src/internet/model/udp-socket-impl.cc Wed Jan 15 23:35:55 2014 +0100
@@ -180,6 +180,25 @@
m_endPoint6 = 0;
}
+/* Deallocate the end point and cancel all the timers */
+void
+UdpSocketImpl::DeallocateEndPoint (void)
+{
+ if (m_endPoint != 0)
+ {
+ m_endPoint->SetDestroyCallback (MakeNullCallback<void> ());
+ m_udp->DeAllocate (m_endPoint);
+ m_endPoint = 0;
+ }
+ if (m_endPoint6 != 0)
+ {
+ m_endPoint6->SetDestroyCallback (MakeNullCallback<void> ());
+ m_udp->DeAllocate (m_endPoint6);
+ m_endPoint6 = 0;
+ }
+}
+
+
int
UdpSocketImpl::FinishBind (void)
{
@@ -318,6 +337,7 @@
}
m_shutdownRecv = true;
m_shutdownSend = true;
+ DeallocateEndPoint ();
return 0;
}
--- a/src/internet/model/udp-socket-impl.h Wed Jan 15 10:12:52 2014 -0800
+++ b/src/internet/model/udp-socket-impl.h Wed Jan 15 23:35:55 2014 +0100
@@ -159,6 +159,11 @@
void Destroy6 (void);
/**
+ * \brief Deallocate m_endPoint and m_endPoint6
+ */
+ void DeallocateEndPoint (void);
+
+ /**
* \brief Send a packet
* \param p packet
* \returns 0 on success, -1 on failure