Skip to content

Commit 9934496

Browse files
kjbraceyKimmo Vaisanen
authored andcommitted
LWIP: don't pbuf_free(NULL) on socket close
`pbuf_free(NULL)` causes an `LWIP_ASSERT`. Make the call conditional. Fixes #12184
1 parent dfa80ea commit 9934496

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
@@ -277,7 +277,9 @@ nsapi_error_t LWIP::socket_close(nsapi_socket_t handle)
277277
_event_flag.wait_any(TCP_CLOSED_FLAG, TCP_CLOSE_TIMEOUT);
278278
}
279279
#endif
280-
pbuf_free(s->buf);
280+
if (s->buf) {
281+
pbuf_free(s->buf);
282+
}
281283
err_t err = netconn_delete(s->conn);
282284
arena_dealloc(s);
283285
return err_remap(err);

0 commit comments

Comments
 (0)