From e06868a53bfca19990826cfe5d25dff510ea4631 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 10 Jun 2013 21:48:58 +0000 Subject: [PATCH] geometry.index: potential memleak fixed in pack. [SVN r84733] --- include/boost/geometry/index/detail/rtree/pack_create.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/boost/geometry/index/detail/rtree/pack_create.hpp b/include/boost/geometry/index/detail/rtree/pack_create.hpp index 0812e7d5a..6b29188f9 100644 --- a/include/boost/geometry/index/detail/rtree/pack_create.hpp +++ b/include/boost/geometry/index/detail/rtree/pack_create.hpp @@ -256,8 +256,15 @@ private: // 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; }