Skip to content

Commit

Permalink
deleting pbuf when partially consumed
Browse files Browse the repository at this point in the history
  • Loading branch information
andreagilardoni committed Jan 23, 2024
1 parent c595cc0 commit 906bab9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions libraries/lwIpWrapper/src/lwipClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,12 @@ void lwipClient::stop() {

// reset all the other variables in this class

// if(tcp->p != nullptr) {
// pbuf_free(tcp->p); // FIXME it happens that a pbuf, with ref == 0 is added for some reason
// }
if(this->tcp_info->pbuf_head != nullptr) {
pbuf_free(this->tcp_info->pbuf_head); // FIXME it happens that a pbuf, with ref == 0 is added for some reason
this->tcp_info->pbuf_head = nullptr;
}
this->tcp_info->pbuf_offset = 0;

if(this->tcp_info->server != nullptr) {
// need to first make the server point to nullptr, then remove the client, can cause infinite recursion
auto server = this->tcp_info->server;
Expand Down

0 comments on commit 906bab9

Please sign in to comment.