diff --git a/CHANGELOG.md b/CHANGELOG.md index 91ed0474..db578e8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ Version 47 * Disable operator<< for buffer_body * buffer_size overload for basic_multi_buffer::const_buffers_type * Fix undefined behavior in pausation +* Fix leak in basic_flat_buffer API Changes: diff --git a/include/beast/core/impl/flat_buffer.ipp b/include/beast/core/impl/flat_buffer.ipp index ff7ee824..8ae96b5d 100644 --- a/include/beast/core/impl/flat_buffer.ipp +++ b/include/beast/core/impl/flat_buffer.ipp @@ -220,7 +220,7 @@ prepare(std::size_t n) -> detail::next_pow2(len + n), min_size)); auto const p = alloc_traits::allocate( this->member(), new_size); - if(len > 0) + if(p_) { BOOST_ASSERT(p); BOOST_ASSERT(in_); @@ -266,7 +266,7 @@ reserve(std::size_t n) auto const p = alloc_traits::allocate( this->member(), new_size); auto const len = size(); - if(len > 0) + if(p_) { BOOST_ASSERT(p_); BOOST_ASSERT(in_);