This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[libstdc++-v3] PR 60308: leak in deque constructor


Hello,

this fixes a bug I introduced when adding noexcept all over the place by reverting the guilty bit.

Tested with no regression on x86_64-linux-gnu, and checked that the leak has disappeared in the PR.

2014-02-22  Marc Glisse  <marc.glisse@inria.fr>

	PR libstdc++/60308
	* include/bits/stl_deque.h (_Deque_base::_Deque_base(const
	allocator_type&)): Remove redundant call to _M_initialize_map.
	(deque::deque(const allocator_type&)): Initialize _Base with a
	constructor that calls _M_initialize_map.

	Partial revert:

	2013-09-20  Marc Glisse  <marc.glisse@inria.fr>
	PR libstdc++/58338
	(_Deque_base) [_Deque_base(const allocator_type&)]: Add missing call to
	_M_initialize_map.


--
Marc Glisse
Index: include/bits/stl_deque.h
===================================================================
--- include/bits/stl_deque.h	(revision 208040)
+++ include/bits/stl_deque.h	(working copy)
@@ -460,21 +460,21 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       _Deque_base(size_t __num_elements)
       : _M_impl()
       { _M_initialize_map(__num_elements); }
 
       _Deque_base(const allocator_type& __a, size_t __num_elements)
       : _M_impl(__a)
       { _M_initialize_map(__num_elements); }
 
       _Deque_base(const allocator_type& __a)
       : _M_impl(__a)
-      { _M_initialize_map(0); }
+      { }
 
 #if __cplusplus >= 201103L
       _Deque_base(_Deque_base&& __x)
       : _M_impl(std::move(__x._M_get_Tp_allocator()))
       {
 	_M_initialize_map(0);
 	if (__x._M_impl._M_map)
 	  {
 	    std::swap(this->_M_impl._M_start, __x._M_impl._M_start);
 	    std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish);
@@ -786,21 +786,21 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
        *  @brief  Creates a %deque with no elements.
        */
       deque() : _Base() { }
 
       /**
        *  @brief  Creates a %deque with no elements.
        *  @param  __a  An allocator object.
        */
       explicit
       deque(const allocator_type& __a)
-      : _Base(__a) { }
+      : _Base(__a, 0) { }
 
 #if __cplusplus >= 201103L
       /**
        *  @brief  Creates a %deque with default constructed elements.
        *  @param  __n  The number of elements to initially create.
        *
        *  This constructor fills the %deque with @a n default
        *  constructed elements.
        */
       explicit

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]