Skip to content

Commit 2c1c845

Browse files
andreas.larssonadbridge
authored andcommitted
Added copying of the wifi_link_out buffer since the buffer might change after call chain has ended.
1 parent 10cfea3 commit 2c1c845

File tree

1 file changed

+5
-3
lines changed
  • targets/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_EVK_ODIN_W2/sdk/wifi_emac

1 file changed

+5
-3
lines changed

targets/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_EVK_ODIN_W2/sdk/wifi_emac/wifi_emac_api.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,11 @@ static void send_packet(emac_interface_t *emac, void *buf)
265265
static bool wifi_link_out(emac_interface_t *emac, emac_stack_mem_t *buf)
266266
{
267267
(void)emac;
268-
// Break call chain to avoid the driver affecting stack usage for the IP stack thread too much
269-
emac_stack_mem_ref(emac,buf);
270-
cbMAIN_getEventQueue()->call(send_packet,emac,buf);
268+
// Break call chain to avoid the driver affecting stack usage for the IP stack thread too much
269+
emac_stack_mem_t *new_buf = emac_stack_mem_alloc(emac, emac_stack_mem_chain_len(emac,buf),0);
270+
emac_stack_mem_copy(emac,new_buf,buf);
271+
cbMAIN_getEventQueue()->call(send_packet,emac,new_buf);
272+
cbMAIN_dispatchEventQueue();
271273
return true;
272274
}
273275

0 commit comments

Comments
 (0)