[ovs-dev] [PATCH] ofp-parse: Correctly update bucket lists if they are empty

Simon Horman simon.horman at netronome.com
Wed Jan 28 22:48:38 UTC 2015


On Wed, Jan 28, 2015 at 11:33:05PM +0100, Thomas Graf wrote:
> On 01/28/15 at 01:22pm, Ben Pfaff wrote:
> > Are you sure?  What *gms points to, that is, **gms, is freed, but *gms
> > should still point to the same location.  list_moved() never
> > dereferences 'orig', only compares it against list->next.  In a very
> > language-lawyer way, working with a pointer to freed memory may be
> > technically "undefined behavior", but I don't know of bad effects in
> > practice.
> 
> What Ben proposed is definitely fine. It's like a NULL check except
> that NULL is not 0x0 but something else ;-)

Thanks, I also agree that Ben is correct and that my earlier analysis
surrounding realloc was incorrect: I missed the distinction between
*cms and **gms.

I now have no problems with Ben's solution and would be happy
to see it merged.



More information about the dev mailing list