Fixed memory leak caused by my last pbuf_ref change.

This commit is contained in:
davidhaas 2003-03-21 23:01:20 +00:00
parent 859f06a91e
commit 96f2e162ef

View File

@ -547,14 +547,16 @@ pbuf_free(struct pbuf *p)
p->flags == PBUF_FLAG_RAM || p->flags == PBUF_FLAG_RAM ||
p->flags == PBUF_FLAG_REF ); p->flags == PBUF_FLAG_REF );
LWIP_ASSERT("pbuf_free: p->ref > 0", p->ref > 0);
/* Since decrementing ref cannot be guarranteed to be a single machine operation /* Since decrementing ref cannot be guarranteed to be a single machine operation
we must protect it. Also, the later test of ref must be protected. we must protect it. Also, the later test of ref must be protected.
*/ */
SYS_ARCH_PROTECT(old_level); SYS_ARCH_PROTECT(old_level);
/* Decrement reference count. */ /* Decrement reference count. */
p->ref--; for (q = p; q != NULL; q = q->next) {
LWIP_ASSERT("pbuf_free: q->ref == 0", q->ref > 0);
q->ref--;
}
/*q = NULL; DJH: Unnecessary statement*/ /*q = NULL; DJH: Unnecessary statement*/
/* If reference count == 0, actually deallocate pbuf. */ /* If reference count == 0, actually deallocate pbuf. */