File tree Expand file tree Collapse file tree 3 files changed +12
-4
lines changed
nanostack/mbed-mesh-api/source
netsocket/tests/emac_test_utils Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -189,5 +189,9 @@ void LWIPMemoryManager::set_total_len(struct pbuf *pbuf)
189189
190190void mbed_lwip_on_pbuf_pool_free_hook ()
191191{
192- LWIP::get_instance ().get_memory_manager ().onPoolSpaceAvailCallback ();
192+ auto & callback = LWIP::get_instance ().get_memory_manager ().onPoolSpaceAvailCallback ;
193+ if (callback)
194+ {
195+ callback ();
196+ }
193197}
Original file line number Diff line number Diff line change @@ -158,5 +158,9 @@ NetStackMemoryManager::Lifetime NanostackMemoryManager::get_lifetime(const net_s
158158
159159void mbed_ns_heap_free_hook ()
160160{
161- Nanostack::get_instance ().get_memory_manager ().onPoolSpaceAvailCallback ();
161+ auto & callback = Nanostack::get_instance ().get_memory_manager ().onPoolSpaceAvailCallback ;
162+ if (callback)
163+ {
164+ callback ();
165+ }
162166}
Original file line number Diff line number Diff line change @@ -317,7 +317,7 @@ void EmacTestMemoryManager::free(emac_mem_buf_t *buf)
317317
318318 m_mem_mutex.unlock ();
319319
320- if (pool_buf_freed) {
320+ if (pool_buf_freed && onPoolSpaceAvailCallback ) {
321321 onPoolSpaceAvailCallback ();
322322 }
323323}
@@ -514,7 +514,7 @@ void EmacTestMemoryManager::set_memory_available(bool memory)
514514 m_memory_available = memory;
515515
516516 // Poke the EMAC in case it can allocate buffers
517- if (m_memory_available) {
517+ if (m_memory_available && onPoolSpaceAvailCallback ) {
518518 onPoolSpaceAvailCallback ();
519519 }
520520}
You can’t perform that action at this time.
0 commit comments