Ticket #6701: pool.patch
File pool.patch, 1.1 KB (added by , 11 years ago) |
---|
-
boost/pool/pool.hpp
10 10 #define BOOST_POOL_HPP 11 11 12 12 #include <boost/config.hpp> // for workarounds 13 // std::numeric_limits 14 #include <boost/limits.hpp> 13 15 14 16 // std::less, std::less_equal, std::greater 15 17 #include <functional> … … 793 795 //! \returns Address of chunk n if allocated ok. 794 796 //! \returns 0 if not enough memory for n chunks. 795 797 798 if (requested_size && (n > (std::numeric_limits<size_type>::max)() / requested_size)) 799 return 0; 796 800 const size_type partition_size = alloc_size(); 797 801 const size_type total_req_size = n * requested_size; 798 802 const size_type num_chunks = total_req_size / partition_size + … … 975 979 { 976 980 if(max_alloc_size && (n > max_alloc_size)) 977 981 return 0; 982 if(chunk_size && (n > (std::numeric_limits<size_type>::max)() / chunk_size)) 983 return 0; 978 984 void* ret = (user_allocator::malloc)(chunk_size * n); 979 985 used_list.insert(ret); 980 986 return ret;