mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-25 18:14:53 +00:00
Fixed memory leak caused by my last pbuf_ref change.
This commit is contained in:
parent
859f06a91e
commit
96f2e162ef
@ -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. */
|
||||||
|
Loading…
Reference in New Issue
Block a user