Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r84994 - trunk/boost/interprocess/detail
From: igaztanaga_at_[hidden]
Date: 2013-07-09 17:22:15


Author: igaztanaga
Date: 2013-07-09 17:22:15 EDT (Tue, 09 Jul 2013)
New Revision: 84994
URL: http://svn.boost.org/trac/boost/changeset/84994

Log:
Add missing delete and additional checks in intermodule singleton code

Text files modified:
   trunk/boost/interprocess/detail/intermodule_singleton_common.hpp | 2 +-
   trunk/boost/interprocess/detail/windows_intermodule_singleton.hpp | 5 ++++-
   2 files changed, 5 insertions(+), 2 deletions(-)

Modified: trunk/boost/interprocess/detail/intermodule_singleton_common.hpp
==============================================================================
--- trunk/boost/interprocess/detail/intermodule_singleton_common.hpp Tue Jul 9 17:21:00 2013 (r84993)
+++ trunk/boost/interprocess/detail/intermodule_singleton_common.hpp 2013-07-09 17:22:15 EDT (Tue, 09 Jul 2013) (r84994)
@@ -309,7 +309,7 @@
 
 
 //Now this class is a singleton, initializing the singleton in
-//the first get() function call if LazyInit is false. If true
+//the first get() function call if LazyInit is true. If false
 //then the singleton will be initialized when loading the module.
 template<typename C, bool LazyInit, bool Phoenix, class ThreadSafeGlobalMap>
 class intermodule_singleton_impl

Modified: trunk/boost/interprocess/detail/windows_intermodule_singleton.hpp
==============================================================================
--- trunk/boost/interprocess/detail/windows_intermodule_singleton.hpp Tue Jul 9 17:21:00 2013 (r84993)
+++ trunk/boost/interprocess/detail/windows_intermodule_singleton.hpp 2013-07-09 17:22:15 EDT (Tue, 09 Jul 2013) (r84994)
@@ -135,6 +135,7 @@
          success = success && m_sem_map.open_or_create
             (name.c_str(), initial_count, max_count, perm, created);
          if(!success){
+ delete m;
             //winapi_xxx wrappers do the cleanup...
             throw int(0);
          }
@@ -217,7 +218,9 @@
       scoped_lock<winapi_mutex_wrapper> lck(m_mtx_lock);
       m_sem_count.wait();
       if(0 == m_sem_count.value()){
- delete &this->get_map_unlocked();
+ map_type &map = this->get_map_unlocked();
+ BOOST_ASSERT(map.empty());
+ delete &map;
       }
       //First close sems to protect this with the external mutex
       m_sem_map.close();


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk