[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] netconn_recv memory leak

From: Mattia Berton
Subject: [lwip-users] netconn_recv memory leak
Date: Wed, 13 Mar 2019 08:07:56 -0700 (MST)

I'm using LWIP (2.0.2) with ESP32. I'm using netconn for communicating, and
since the payload is too large, I've implemented a while loop to get the
full message. However, I'm observing a memory leak in this part of the
err = netconn_recv(conn, &inbuf);
while (conn->recv_avail > 0)
        err = netconn_recv(conn, &inbuf);
        netbuf_data(inbuf, (void**)&buf, &buflen);                      
        snprintf(&test[j], buflen + 1, "%s", buf);
        j += buflen;
// close the connection and free the buffer

In particular, it seems that netconn_recv inside the while loop is what is
leaking the memory. I tried to free the memory inside the while loop using
the netconn_close(conn);, but it doesn't work. 
How can I correctly free the memory of netconn_recv?

Thank you,

Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

reply via email to

[Prev in Thread] Current Thread [Next in Thread]