[Top][All Lists]

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

[lwip-users] to free or not to free (pbuf_free in tcp_recv)

From: cbergs
Subject: [lwip-users] to free or not to free (pbuf_free in tcp_recv)
Date: Wed, 23 Jan 2019 15:05:06 +0100


I'm working with the lwIP 1.4.1 on a TI M4 platform with rawapi and I'm
having trouble to understand the documentation correctly.
In particular the callback for tcp_recv(). In the rawapi.txt is said 

"If there are no errors and the callback function is to return ERR_OK, then
it must free the pbuf. 
Otherwise, it must not  free the pbuf so that lwIP core code can store it."

But in the echo example there is this part: 
echo_recv() { 
else if(err != ERR_OK)
    /* cleanup, for unkown reason */
    if (p != NULL)
      es->p = NULL;
    ret_err = err;

The pbuf is freed AND the callback function returns an error. What would
happen with the pbuf if it is not freed? 

Kind regards,

reply via email to

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