Added missing checks for wifi_link_out when allocating packets

pull/3221/head
andreas.larsson 2016-10-31 14:52:27 +01:00
parent fd7c9cc13a
commit 32dfe73b09
1 changed files with 10 additions and 3 deletions

View File

@ -267,9 +267,16 @@ static bool wifi_link_out(emac_interface_t *emac, emac_stack_mem_t *buf)
(void)emac;
// Break call chain to avoid the driver affecting stack usage for the IP stack thread too much
emac_stack_mem_t *new_buf = emac_stack_mem_alloc(emac, emac_stack_mem_chain_len(emac,buf),0);
emac_stack_mem_copy(emac,new_buf,buf);
cbMAIN_getEventQueue()->call(send_packet,emac,new_buf);
cbMAIN_dispatchEventQueue();
if (new_buf != NULL) {
emac_stack_mem_copy(emac, new_buf, buf);
int id = cbMAIN_getEventQueue()->call(send_packet, emac, new_buf);
if (id != 0) {
cbMAIN_dispatchEventQueue();
}
else {
emac_stack_mem_free(emac, new_buf);
}
}
return true;
}