lwip-devel
[Top][All Lists]
Advanced

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

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


From: Derek Guerdon
Subject: [lwip-devel] [bug #27105] realloc() cannot replace mem_realloc()
Date: Tue, 28 Jul 2009 13:46:29 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1

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

#define mem_realloc(x,y) (x) does work.

The code actually used this but was changed in response to issue #23254,
which wanted the mem_ macros to reference function pointers rather than
function-like macros. This was apparently to allow the function pointers to be
passed around in messages.  

If a pointer to mem_realloc needs to be passed in messages, a dummy function
that does nothing but return the pointer given should be implemented. But lwIP
itself doesn't do this. The only place mem_realloc is used is when it's called
by pbuf_realloc.

I have to strongly disagree with the statement that not making the change is
low risk. I only discovered this bug it happened to me. And our compiler's
library is from Dinkumware, whose libraries are widely used. 

Moving the payload pointer won't work because with RAM pbuf types, the pbuf
and the payload are one. This is the whole reason that the code can't use
realloc. When the memory is reallocated, the pbuf pointer moves, but
pbuf_realloc does not return a pointer to the new pbuf. 

I think the cleanest solution would be to have pbuf_realloc return a pointer
to the new pbuf. 

But for 1.3.1, I think the best idea is to roll back to the pre-#23254
definition since it works. The change was made as a convenience, but isn't
required by lwIP.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?27105>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/





reply via email to

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