lwip: fix mbox thread-safe issue

Fix a mbox free thread-safe issue that can lead to crash in sys_arch_mbox_fetch.
This commit is contained in:
Liu Zhi Fu
2018-12-20 14:03:11 +08:00
parent 0700cde229
commit 6933c103e5
3 changed files with 22 additions and 4 deletions
@@ -352,7 +352,6 @@ sys_mbox_free(sys_mbox_t *mbox)
uint32_t mbox_message_num = 0;
if ( (NULL == mbox) || (NULL == *mbox) ) {
ESP_LOGW(TAG, "WARNING: free null mbox\n");
return;
}
@@ -390,12 +389,13 @@ sys_mbox_free(sys_mbox_t *mbox)
/* For recvmbox or acceptmbox, free them in netconn_free() when all sockets' API are returned */
vQueueDelete((*mbox)->os_mbox);
free(*mbox);
*mbox = NULL;
}
#else
vQueueDelete((*mbox)->os_mbox);
free(*mbox);
#endif
*mbox = NULL;
#endif
}
/*-----------------------------------------------------------------------------------*/