diff options
author | Earl Chew <earl_chew@agilent.com> | 2005-02-26 23:34:36 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2005-02-26 23:34:36 +0000 |
commit | 7320b491ec63d1e8aeb9604f7d0e96e614cf94eb (patch) | |
tree | a029e8eef16bca52f634a1bfbf2a9fe856d53c91 | |
parent | 5395b47b3c40aa64fc6f388af69aa2c9e0cb9f0b (diff) | |
download | gcc-7320b491ec63d1e8aeb9604f7d0e96e614cf94eb.zip gcc-7320b491ec63d1e8aeb9604f7d0e96e614cf94eb.tar.gz gcc-7320b491ec63d1e8aeb9604f7d0e96e614cf94eb.tar.bz2 |
stl_tree.h (_Rb_tree<>::_M_insert): Don't leak memory if _M_key_compare throws.
2005-02-26 Earl Chew <earl_chew@agilent.com>
Christopher Jefferson <chris@bubblescope.net>
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert): Don't leak
memory if _M_key_compare throws.
Co-Authored-By: Chris Jefferson <chris@bubblescope.net>
From-SVN: r95597
-rw-r--r-- | libstdc++-v3/ChangeLog | 6 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/stl_tree.h | 9 |
2 files changed, 10 insertions, 5 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 3982be6..441bb58 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2005-02-26 Earl Chew <earl_chew@agilent.com> + Christopher Jefferson <chris@bubblescope.net> + + * include/bits/stl_tree.h (_Rb_tree<>::_M_insert): Don't leak + memory if _M_key_compare throws. + 2005-02-25 Paolo Carlini <pcarlini@suse.de> * include/tr1/type_traits: Add the trivial is_union and is_class; diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h index 4da42c1..c514563 100644 --- a/libstdc++-v3/include/bits/stl_tree.h +++ b/libstdc++-v3/include/bits/stl_tree.h @@ -786,12 +786,11 @@ namespace std _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: _M_insert(_Base_ptr __x, _Base_ptr __p, const _Val& __v) { - _Link_type __z = _M_create_node(__v); - bool __insert_left; + bool __insert_left = (__x != 0 || __p == _M_end() + || _M_impl._M_key_compare(_KeyOfValue()(__v), + _S_key(__p))); - __insert_left = (__x != 0 || __p == _M_end() - || _M_impl._M_key_compare(_KeyOfValue()(__v), - _S_key(__p))); + _Link_type __z = _M_create_node(__v); _Rb_tree_insert_and_rebalance(__insert_left, __z, __p, this->_M_impl._M_header); |