[Top][All Lists]

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

[lwip-devel] [bug #27105] realloc() cannot replace mem_realloc()

From: Jeff Barber
Subject: [lwip-devel] [bug #27105] realloc() cannot replace mem_realloc()
Date: Mon, 27 Jul 2009 21:18:56 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/2009070611 Firefox/3.0.12

Follow-up Comment #3, bug #27105 (project lwip):

A standards-compliant realloc (pick your favorite: posix, ISO C, etc.) is
permitted to move the allocated memory if the size changes, whether it shrinks
or grows.  

The typical realloc implementation does not move the memory if the block
shrinks so I agree it's pretty low-risk for production code.  There are
however debug versions of the malloc/realloc/free library that *always* move
the memory whenever they're permitted to -- just to find bugs like this.  

I think merely resetting the payload pointer based on the (possibly moved)
pointer returned by realloc would also fix the problem.  However, I certainly
wouldn't argue that this change should go into 1.3.1.


Reply to this item at:


  Message sent via/by Savannah

reply via email to

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