[libcxx] r206024 - Remove node from a container before destroying it. Thanks to Alexander Potapenko for pointing this out.

Marshall Clow mclow.lists at gmail.com
Fri Apr 11 01:22:42 PDT 2014


Author: marshall
Date: Fri Apr 11 03:22:42 2014
New Revision: 206024

URL: http://llvm.org/viewvc/llvm-project?rev=206024&view=rev
Log:
Remove node from a container before destroying it. Thanks to Alexander Potapenko for pointing this out.

Modified:
    libcxx/trunk/include/__tree

Modified: libcxx/trunk/include/__tree
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__tree?rev=206024&r1=206023&r2=206024&view=diff
==============================================================================
--- libcxx/trunk/include/__tree (original)
+++ libcxx/trunk/include/__tree Fri Apr 11 03:22:42 2014
@@ -1980,9 +1980,9 @@ __tree<_Tp, _Compare, _Allocator>::erase
         __begin_node() = __r.__ptr_;
     --size();
     __node_allocator& __na = __node_alloc();
-    __node_traits::destroy(__na, const_cast<value_type*>(_VSTD::addressof(*__p)));
     __tree_remove(__end_node()->__left_,
                   static_cast<__node_base_pointer>(__np));
+    __node_traits::destroy(__na, const_cast<value_type*>(_VSTD::addressof(*__p)));
     __node_traits::deallocate(__na, __np, 1);
     return __r;
 }





More information about the cfe-commits mailing list