diff mbox

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

Message ID alpine.DEB.2.02.1402220934130.13738@stedding.saclay.inria.fr
State New
Headers show

Commit Message

Marc Glisse Feb. 22, 2014, 8:53 a.m. UTC
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.

Comments

Jonathan Wakely Feb. 22, 2014, 9:29 a.m. UTC | #1
On 22 February 2014 08:53, Marc Glisse wrote:
> 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.
>

This is OK, thanks for the quick fix.
diff mbox

Patch

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