Skip to content

Commit 988ef09

Browse files
committed
LWIP: don't pbuf_free(NULL) on socket close
`pbuf_free(NULL)` causes an `LWIP_ASSERT`. Make the call conditional. Fixes #12184
1 parent 5d71e69 commit 988ef09

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

features/lwipstack/LWIPStack.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,9 @@ nsapi_error_t LWIP::socket_close(nsapi_socket_t handle)
307307
_event_flag.wait_any(TCP_CLOSED_FLAG, TCP_CLOSE_TIMEOUT);
308308
}
309309
#endif
310-
pbuf_free(s->buf);
310+
if (s->buf) {
311+
pbuf_free(s->buf);
312+
}
311313
err_t err = netconn_delete(s->conn);
312314
arena_dealloc(s);
313315
return err_remap(err);

0 commit comments

Comments
 (0)