lwip: fix crash caused by sys_mbox_free
Fix lwip crashed bug caused by sys_mbox_free()
This commit is contained in:
@@ -710,6 +710,14 @@ netconn_alloc(enum netconn_type t, netconn_callback callback)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ESP_THREAD_SAFE
|
||||
conn->recvmbox_ref = conn->recvmbox;
|
||||
sys_mbox_set_owner(&conn->recvmbox, conn);
|
||||
#if LWIP_TCP
|
||||
sys_mbox_set_invalid(&conn->acceptmbox_ref);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if LWIP_TCP
|
||||
sys_mbox_set_invalid(&conn->acceptmbox);
|
||||
#endif
|
||||
@@ -760,6 +768,18 @@ netconn_free(struct netconn *conn)
|
||||
!sys_mbox_valid(&conn->acceptmbox));
|
||||
#endif /* LWIP_TCP */
|
||||
|
||||
#if ESP_THREAD_SAFE
|
||||
if (conn->recvmbox_ref) {
|
||||
sys_mbox_free(&conn->recvmbox_ref);
|
||||
}
|
||||
|
||||
#if LWIP_TCP
|
||||
if (conn->acceptmbox_ref) {
|
||||
sys_mbox_free(&conn->acceptmbox_ref);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !LWIP_NETCONN_SEM_PER_THREAD
|
||||
sys_sem_free(&conn->op_completed);
|
||||
sys_sem_set_invalid(&conn->op_completed);
|
||||
@@ -1399,6 +1419,10 @@ lwip_netconn_do_listen(void *m)
|
||||
msg->err = sys_mbox_new(&msg->conn->acceptmbox, DEFAULT_ACCEPTMBOX_SIZE);
|
||||
}
|
||||
if (msg->err == ERR_OK) {
|
||||
#if ESP_THREAD_SAFE
|
||||
msg->conn->acceptmbox_ref = msg->conn->acceptmbox;
|
||||
sys_mbox_set_owner(&msg->conn->acceptmbox, msg->conn);
|
||||
#endif
|
||||
msg->conn->state = NETCONN_LISTEN;
|
||||
msg->conn->pcb.tcp = lpcb;
|
||||
tcp_arg(msg->conn->pcb.tcp, msg->conn);
|
||||
|
||||
Reference in New Issue
Block a user