diff options
author | Damien George <damien.p.george@gmail.com> | 2019-03-27 16:00:25 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2019-04-01 13:36:43 +1100 |
commit | 2ec7838967aec9d43d44c2d53377e827d6fcf041 (patch) | |
tree | 7ce2153bedfb2ddccb973424e5c6c53a7f47c4bd | |
parent | da938a83b587c7387b8849f795f3497735d14267 (diff) |
extmod/modlwip: Handle case of accept callback called with null PCB.
-rw-r--r-- | extmod/modlwip.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/extmod/modlwip.c b/extmod/modlwip.c index d1359a2aa..6960546f6 100644 --- a/extmod/modlwip.c +++ b/extmod/modlwip.c @@ -429,6 +429,11 @@ STATIC err_t _lwip_tcp_accept_finished(void *arg, struct tcp_pcb *pcb) // Callback for incoming tcp connections. STATIC err_t _lwip_tcp_accept(void *arg, struct tcp_pcb *newpcb, err_t err) { + // err can be ERR_MEM to notify us that there was no memory for an incoming connection + if (err != ERR_OK) { + return ERR_OK; + } + lwip_socket_obj_t *socket = (lwip_socket_obj_t*)arg; tcp_recv(newpcb, _lwip_tcp_recv_unaccepted); |