lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [bug #17922] mem_malloc bug


From: anonymous
Subject: [lwip-devel] [bug #17922] mem_malloc bug
Date: Thu, 05 Oct 2006 21:29:26 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7

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

                 Summary: mem_malloc bug
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: None
            Submitted on: Thursday 10/05/2006 at 21:29 UTC
                Category: None
                Severity: 3 - Normal
              Item Group: Faulty Behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open

    _______________________________________________________

Details:

I've run across what I believe to be a bug in mem_malloc.

Basically, if you allocate all the memory in multiple blocks, then free the
first block you allocated, you cannot allocate a new block of the same size.

The following code fails:

test() {
 void * ptr1
 void * cur;

 /** allocate the first block */
 ptr1 = mem_malloc(200);
 ASSERT(ptr1); /* <--- this succeeds */

 /** allocate all the remaining blocks */
 do {
   cur = mem_malloc(200);
 } while (cur);

 /** free the first block */
 mem_free(ptr1);

 /** now attempt to re-allocate the 200 bytes just freed */
 ptr1 = mem_malloc(200);
 ASSERT(ptr1);  /* <---- this FAILS */
}

Please refer to this thread for more information:
http://lists.nongnu.org/archive/html/lwip-users/2006-10/msg00001.html






    _______________________________________________________

Reply to this item at:

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

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





reply via email to

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