Fix hashtable node deallocation
François Dumont
frs.dumont@gmail.com
Sat Nov 10 21:40:00 GMT 2018
While working on a hashtable enhancement I noticed that we are not using
the correct method to deallocate node if the constructor throws in
_ReuseOrAllocNode operator(). I had to introduce a new
_M_deallocate_node_ptr for that as node value shall not be destroy again.
I also check other places and noticed that a __node_type destructor call
was missing.
   * include/bits/hashtable_policy.h
(_Hashtable_alloc<>::_M_deallocate_node_ptr(__node_type*)): New.
   (_Hashtable_alloc<>::_M_deallocate_node(__node_type*)): Use latter.
(_ReuseOrAllocNode<>::operator<_Arg>()(_Arg&&)): Likewise.
   (_Hashtable_alloc<>::_M_allocate_node): Add ~__node_type call.
Tested under Linux x86_64.
Ok to commit ?
François
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hashtable_dealloc.patch
Type: text/x-patch
Size: 1704 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20181110/ba37d998/attachment.bin>
More information about the Gcc-patches
mailing list