Skip to content

Commit 2d985eb

Browse files
kjbraceyadbridge
authored andcommitted
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 414a0c1 commit 2d985eb

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
@@ -691,6 +691,7 @@ static nsapi_error_t mbed_lwip_socket_close(nsapi_stack_t *stack, nsapi_socket_t
691691
{
692692
struct lwip_socket *s = (struct lwip_socket *)handle;
693693

694+
netbuf_delete(s->buf);
694695
err_t err = netconn_delete(s->conn);
695696
mbed_lwip_arena_dealloc(s);
696697
return mbed_lwip_err_remap(err);

0 commit comments

Comments
 (0)