From a59bdc3a301fc095b67a8b8ee1c4e91ca16a8663 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Wed, 10 Aug 2011 13:14:42 -0400 Subject: [PATCH] bug 1239: Add assertion that reference count never overflows --- src/core/model/simple-ref-count.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/core/model/simple-ref-count.h b/src/core/model/simple-ref-count.h index ed0d42488..ad2916a18 100644 --- a/src/core/model/simple-ref-count.h +++ b/src/core/model/simple-ref-count.h @@ -24,7 +24,9 @@ #include "empty.h" #include "default-deleter.h" +#include "assert.h" #include +#include namespace ns3 { @@ -79,6 +81,7 @@ public: */ inline void Ref (void) const { + NS_ASSERT (m_count < std::numeric_limits::max()); m_count++; } /**