Skip to content

Commit

Permalink
Fix assert failure
Browse files Browse the repository at this point in the history
  • Loading branch information
multiplemonomials committed Jan 28, 2025
1 parent 272a06f commit c1d4487
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
6 changes: 5 additions & 1 deletion connectivity/lwipstack/source/LWIPMemoryManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,9 @@ void LWIPMemoryManager::set_total_len(struct pbuf *pbuf)

void mbed_lwip_on_pbuf_pool_free_hook()
{
LWIP::get_instance().get_memory_manager().onPoolSpaceAvailCallback();
auto & callback = LWIP::get_instance().get_memory_manager().onPoolSpaceAvailCallback;
if(callback)
{
callback();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,9 @@ NetStackMemoryManager::Lifetime NanostackMemoryManager::get_lifetime(const net_s

void mbed_ns_heap_free_hook()
{
Nanostack::get_instance().get_memory_manager().onPoolSpaceAvailCallback();
auto & callback = Nanostack::get_instance().get_memory_manager().onPoolSpaceAvailCallback;
if(callback)
{
callback();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ void EmacTestMemoryManager::free(emac_mem_buf_t *buf)

m_mem_mutex.unlock();

if (pool_buf_freed) {
if (pool_buf_freed && onPoolSpaceAvailCallback) {
onPoolSpaceAvailCallback();
}
}
Expand Down Expand Up @@ -514,7 +514,7 @@ void EmacTestMemoryManager::set_memory_available(bool memory)
m_memory_available = memory;

// Poke the EMAC in case it can allocate buffers
if (m_memory_available) {
if (m_memory_available && onPoolSpaceAvailCallback) {
onPoolSpaceAvailCallback();
}
}
Expand Down

0 comments on commit c1d4487

Please sign in to comment.