mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-26 03:16:18 +00:00
Only access non-NULL pbufs on some paths where they can be NULL in newly introduced callback code
This commit is contained in:
parent
f2d35751ca
commit
848dea2058
@ -496,10 +496,13 @@ netconn_recv(struct netconn *conn)
|
||||
}
|
||||
|
||||
sys_mbox_fetch(conn->recvmbox, (void **)&p);
|
||||
|
||||
if (p != NULL) {
|
||||
conn->recv_avail -= p->tot_len;
|
||||
/* Register event with callback */
|
||||
if (conn->callback)
|
||||
(*conn->callback)(conn, NETCONN_EVT_RCVMINUS, p->tot_len);
|
||||
}
|
||||
|
||||
/* If we are closed, we indicate that we no longer wish to recieve
|
||||
data by setting conn->recvmbox to SYS_MBOX_NULL. */
|
||||
|
@ -51,11 +51,14 @@ recv_tcp(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
|
||||
}
|
||||
|
||||
if(conn->recvmbox != SYS_MBOX_NULL) {
|
||||
|
||||
conn->err = err;
|
||||
if (p != NULL) {
|
||||
conn->recv_avail += p->tot_len;
|
||||
/* Register event with callback */
|
||||
if (conn->callback)
|
||||
(*conn->callback)(conn, NETCONN_EVT_RCVPLUS, p->tot_len);
|
||||
}
|
||||
sys_mbox_post(conn->recvmbox, p);
|
||||
}
|
||||
return ERR_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user