Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r84733 - trunk/boost/geometry/index/detail/rtree
From: adam.wulkiewicz_at_[hidden]
Date: 2013-06-10 17:48:59


Author: awulkiew
Date: 2013-06-10 17:48:58 EDT (Mon, 10 Jun 2013)
New Revision: 84733
URL: http://svn.boost.org/trac/boost/changeset/84733

Log:
geometry.index: potential memleak fixed in pack.

Text files modified:
   trunk/boost/geometry/index/detail/rtree/pack_create.hpp | 7 +++++++
   1 files changed, 7 insertions(+), 0 deletions(-)

Modified: trunk/boost/geometry/index/detail/rtree/pack_create.hpp
==============================================================================
--- trunk/boost/geometry/index/detail/rtree/pack_create.hpp Mon Jun 10 16:36:21 2013 (r84732)
+++ trunk/boost/geometry/index/detail/rtree/pack_create.hpp 2013-06-10 17:48:58 EDT (Mon, 10 Jun 2013) (r84733)
@@ -256,8 +256,15 @@
             // the end, move to the next level
             internal_element el = per_level(first, last, hint_box, values_count, next_subtree_counts,
                                             parameters, translator, allocators);
+
+ // in case if push_back() do throw here
+ // and even if this is not probable (previously reserved memory, nonthrowing pairs copy)
+ // this case is also tested by exceptions test.
+ node_auto_ptr auto_remover(el.second, allocators);
             // this container should have memory allocated, reserve() called outside
             elements.push_back(el); // MAY THROW (A?,C) - however in normal conditions shouldn't
+ auto_remover.release();
+
             geometry::expand(elements_box, el.first);
             return;
         }


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