Skip to content

Commit 2f056f2

Browse files
committed
NSAPI/lwIP: Free held netbuf on close
mbed_lwip_socket_recv() takes one netbuf at a time from the netconn API, and it holds a partially-read netbuf if necessary in order to present as a stream for TCP. This held netbuf was not being freed when the socket was closed.
1 parent 98eb50f commit 2f056f2

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

features/FEATURE_LWIP/lwip-interface/lwip_stack.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,7 @@ static int mbed_lwip_socket_close(nsapi_stack_t *stack, nsapi_socket_t handle)
648648
{
649649
struct lwip_socket *s = (struct lwip_socket *)handle;
650650

651+
netbuf_delete(s->buf);
651652
err_t err = netconn_delete(s->conn);
652653
mbed_lwip_arena_dealloc(s);
653654
return mbed_lwip_err_remap(err);

0 commit comments

Comments
 (0)