[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: 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: Gecko/20090715 Firefox/3.5.1


                 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



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:


  Message sent via/by Savannah

reply via email to

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