Skip to content

Commit 1e3848f

Browse files
committed
fix AsyncClient::connect memory leak me-no-dev#138
1 parent cd3d827 commit 1e3848f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/ESPAsyncTCP.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,9 @@ bool AsyncClient::connect(IPAddress ip, uint16_t port){
266266
tcp_arg(pcb, this);
267267
tcp_err(pcb, &_s_error);
268268
size_t err = tcp_connect(pcb, &addr, port,(tcp_connected_fn)&_s_connected);
269+
if (err != ERR_OK){
270+
tcp_close(pcb);
271+
}
269272
return (ERR_OK == err);
270273
}
271274

0 commit comments

Comments
 (0)