cancel
Showing results for 
Search instead for 
Did you mean: 

LWIP pbuf_free is trying to free a null reference

GreenGuy
Senior III

Working with LWIP using TCP echo example code on STM32H743I_Eval and CMX V1.3.0.

After receiving a packet and extracting the payload netbuf_delete(buf) gets called which works most of the time. When it does not work it throws an assert failure in pbuf.c during the pbuf_free() function when wlaking back through the chain p->ref goes to 0. The packet that is sent is a test packet with know byte count and contents. The number of p->ref is always the same and should be 3 prior to netbuf_delete(). I find that when p->buf should be 2, freeing the second allocated buffer it somehow comes up 0 which causes the assert to be thrown.

Anyone seen this?

3 REPLIES 3

lwip-related questions may have higher chance to be answered in the lwip-users forum https://lists.nongnu.org/mailman/listinfo/lwip-users

JW

GreenGuy
Senior III

That is true however I think that this is also an ST HAL problem.

GreenGuy
Senior III

I fixed the problem inadvertently.

When I reduce the number of LCD_UsrLog() calls printing debug messages to the LCD screen and reduced the text for each call, the Asserts stopped occurring. I did the reduction because I no longer needed the verbosity and noticed that I was slowing down other processes. It would appear that frequent calls to the Utility function has an adverse affect on the Ethernet processing.