diff --git a/include/etl/message_pool.h b/include/etl/message_pool.h index e1c19b3f..f5a46f84 100644 --- a/include/etl/message_pool.h +++ b/include/etl/message_pool.h @@ -126,6 +126,10 @@ namespace etl { ::new(p) TMessage(); } + else + { + ETL_ALWAYS_ASSERT(ETL_ERROR(etl::message_pool_allocation_failure)); + } } return reinterpret_cast(p); @@ -149,6 +153,10 @@ namespace etl { ::new(p) TMessage(t1); } + else + { + ETL_ALWAYS_ASSERT(ETL_ERROR(etl::message_pool_allocation_failure)); + } } return reinterpret_cast(p); @@ -172,6 +180,10 @@ namespace etl { ::new(p) TMessage(t1, t2); } + else + { + ETL_ALWAYS_ASSERT(ETL_ERROR(etl::message_pool_allocation_failure)); + } } return reinterpret_cast(p); @@ -195,6 +207,10 @@ namespace etl { ::new(p) TMessage(t1, t2, t3); } + else + { + ETL_ALWAYS_ASSERT(ETL_ERROR(etl::message_pool_allocation_failure)); + } } return reinterpret_cast(p); @@ -218,6 +234,10 @@ namespace etl { ::new(p) TMessage(t1, t2, t3, t4); } + else + { + ETL_ALWAYS_ASSERT(ETL_ERROR(etl::message_pool_allocation_failure)); + } } return reinterpret_cast(p) @@ -229,8 +249,11 @@ namespace etl //************************************************************************* void destroy(const etl::imessage* const pmsg) { - pmsg->~imessage(); - memory_block_pool.release_memory_block(pmsg); + if (pmsg != ETL_NULLPTR) + { + pmsg->~imessage(); + memory_block_pool.release_memory_block(pmsg); + } } //*************************************************************************