Only access non-NULL pbufs on some paths where they can be NULL in newly introduced callback code

This commit is contained in:
jani 2003-02-11 16:33:02 +00:00
parent f2d35751ca
commit 848dea2058
2 changed files with 12 additions and 6 deletions

View File

@ -496,10 +496,13 @@ netconn_recv(struct netconn *conn)
}
sys_mbox_fetch(conn->recvmbox, (void **)&p);
conn->recv_avail -= p->tot_len;
/* Register event with callback */
if (conn->callback)
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. */

View File

@ -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;
conn->recv_avail += p->tot_len;
/* Register event with callback */
if (conn->callback)
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;