This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[libstdc++-v3] PR 60308: leak in deque constructor
- From: Marc Glisse <marc dot glisse at inria dot fr>
- To: libstdc++ at gcc dot gnu dot org
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sat, 22 Feb 2014 09:53:22 +0100 (CET)
- Subject: [libstdc++-v3] PR 60308: leak in deque constructor
- Authentication-results: sourceware.org; auth=none
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