mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-16 16:13:45 +00:00
LWIP_NETCONN_SEM_PER_THREAD: ensure sys_sem_valid() is only called for non-NULL pointers (not all ports might check this)
This commit is contained in:
parent
7df2dd67bd
commit
a6bd0944db
@ -872,7 +872,7 @@ netconn_gethostbyname(const char *name, ip_addr_t *addr)
|
|||||||
void netconn_thread_init(void)
|
void netconn_thread_init(void)
|
||||||
{
|
{
|
||||||
sys_sem_t *sem = LWIP_NETCONN_THREAD_SEM_GET();
|
sys_sem_t *sem = LWIP_NETCONN_THREAD_SEM_GET();
|
||||||
if (!sys_sem_valid(sem)) {
|
if ((sem == NULL) || !sys_sem_valid(sem)) {
|
||||||
/* call alloc only once */
|
/* call alloc only once */
|
||||||
LWIP_NETCONN_THREAD_SEM_ALLOC();
|
LWIP_NETCONN_THREAD_SEM_ALLOC();
|
||||||
LWIP_ASSERT("LWIP_NETCONN_THREAD_SEM_ALLOC() failed", sys_sem_valid(LWIP_NETCONN_THREAD_SEM_GET()));
|
LWIP_ASSERT("LWIP_NETCONN_THREAD_SEM_ALLOC() failed", sys_sem_valid(LWIP_NETCONN_THREAD_SEM_GET()));
|
||||||
@ -882,7 +882,7 @@ void netconn_thread_init(void)
|
|||||||
void netconn_thread_cleanup(void)
|
void netconn_thread_cleanup(void)
|
||||||
{
|
{
|
||||||
sys_sem_t *sem = LWIP_NETCONN_THREAD_SEM_GET();
|
sys_sem_t *sem = LWIP_NETCONN_THREAD_SEM_GET();
|
||||||
if (sys_sem_valid(sem)) {
|
if ((sem != NULL) && sys_sem_valid(sem)) {
|
||||||
/* call free only once */
|
/* call free only once */
|
||||||
LWIP_NETCONN_THREAD_SEM_FREE();
|
LWIP_NETCONN_THREAD_SEM_FREE();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user