lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] chaining pbufs as an user


From: Simon Goldschmidt
Subject: Re: [lwip-users] chaining pbufs as an user
Date: Thu, 22 Jul 2010 08:22:29 +0200

Mike Kleshov wrote:
> Again, if I am not mistaken, the while loop is needed if there is more
> than 1 reference to the pbuf in question. Perhaps, in this particular
> program this will never happen. Maybe the author of the code put the
> while loop there just to be on the safe side?

I didn't have a look at the code yet, bug writing such a loop is not a good 
idea at all: you should only call pbuf_free as often as you called pbuf_ref 
(and once more for the original reference passed to you, of course). Calling 
pbuf_ref as long as the pbuf has actually been freed would mean that if anyone 
else actually had a reference stored to that pbuf, it would get deallocated 
without the other one noticing. That sounds like a bug in that example code to 
me!

Simon
-- 
GMX DSL: Internet-, Telefon- und Handy-Flat ab 19,99 EUR/mtl.  
Bis zu 150 EUR Startguthaben inklusive! http://portal.gmx.net/de/go/dsl



reply via email to

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