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: Sat, 25 Jul 2009 04:14:24 +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

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

                 Summary: realloc() cannot replace mem_realloc()
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: dguerdon
            Submitted on: Sat 25 Jul 2009 04:14:22 AM GMT
                Category: pbufs
                Severity: 3 - Normal
              Item Group: Faulty Behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: 
            lwIP version: CVS Head

    _______________________________________________________

Details:

In mem.h, the following line causes incorrect behavior:
#define mem_realloc realloc

LWIP's mem_realloc() always returns the same pointer it is given. But STDC's
realloc() may return a pointer to a different location. 

This causes problems for pbuf_realloc(), which depends on the pointer not
changing. When realloc() actually allocates a new area and frees the old one,
writes to freed memory occur when the pbuf is accessed.

To correct this, the mem_realloc macro from above should be modified so that
mem_realloc(x,y) does nothing when MEM_LIBC_MALLOC is used.




    _______________________________________________________

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]