pbuf_free assert failure

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

pbuf_free assert failure

Greenwood, Gregory A.
Leidos Proprietary
 
Working with LWiP on STm32H7 and also using FreeRTOS.
I have set up a TCP thread based on the TCPEcho example distributed by ST in the STM32 CMX repository.
 
In the following code in pbuf_free() the assert is triggered:
  while (p != NULL) {
    u16_t ref;
    SYS_ARCH_DECL_PROTECT(old_level);
    /* Since decrementing ref cannot be guaranteed to be a single machine operation
     * we must protect it. We put the new ref into a local variable to prevent
     * further protection. */
    SYS_ARCH_PROTECT(old_level);
    /* all pbufs in a chain are referenced at least once */
    LWIP_ASSERT("pbuf_free: p->ref > 0", p->ref > 0);
    /* decrease reference count (number of pointers to pbuf) */
    ref = --(p->ref);
    SYS_ARCH_UNPROTECT(old_level);
    /* this pbuf is no longer referenced to? */
    if (ref == 0) {
      /* remember next pbuf in chain for next iteration */
      q = p->next;
      LWIP_DEBUGF( PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_free: deallocating %p\n", (void *)p));
      type = p->type;
 
when it is triggered p->ref is == 0. 
 
I am confused as to why this is happening and I am not certain as to what to instrument to get to the root cause of the problem. 
Any guidance would be very much appreciated.
 
Regards
 
Greg Greenwood | Leidos
Sr. Engineer | Security and Transportation Technology
phone: 858.826.6753
[hidden email] leidos.com/engineering
 
This email and any attachments to it are intended only for the identified recipients. It may contain proprietary or otherwise legally protected information of Leidos. Any unauthorized use or disclosure of this communication is strictly prohibited. If you have received this communication in error, please notify the sender and delete or otherwise destroy the email and all attachments immediately.
 
 
 

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users