[Top][All Lists]

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


                 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



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 */

 /** 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:


Reply to this item at:


  Message sent via/by Savannah

reply via email to

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