Skip to content

Commit 906bab9

Browse files
committedJan 23, 2024
deleting pbuf when partially consumed
1 parent c595cc0 commit 906bab9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed
 

‎libraries/lwIpWrapper/src/lwipClient.cpp

+6-3
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,12 @@ void lwipClient::stop() {
363363

364364
// reset all the other variables in this class
365365

366-
// if(tcp->p != nullptr) {
367-
// pbuf_free(tcp->p); // FIXME it happens that a pbuf, with ref == 0 is added for some reason
368-
// }
366+
if(this->tcp_info->pbuf_head != nullptr) {
367+
pbuf_free(this->tcp_info->pbuf_head); // FIXME it happens that a pbuf, with ref == 0 is added for some reason
368+
this->tcp_info->pbuf_head = nullptr;
369+
}
370+
this->tcp_info->pbuf_offset = 0;
371+
369372
if(this->tcp_info->server != nullptr) {
370373
// need to first make the server point to nullptr, then remove the client, can cause infinite recursion
371374
auto server = this->tcp_info->server;

0 commit comments

Comments
 (0)