[uClibc 0000649]: __heap_alloc_at can't find expected free area

bugs at busybox.net bugs at busybox.net
Tue Jun 3 19:11:41 UTC 2008


A NOTE has been added to this issue. 
====================================================================== 
http://busybox.net/bugs/view.php?id=649 
====================================================================== 
Reported By:                sluo
Assigned To:                uClibc
====================================================================== 
Project:                    uClibc
Issue ID:                   649
Category:                   Standards Compliance
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             01-19-2006 05:31 PST
Last Modified:              06-03-2008 12:11 PDT
====================================================================== 
Summary:                    __heap_alloc_at can't find expected free area
Description: 
The 35th line of libc\stdlib\malloc\heap_alloc_at.c should be
  if (fa_mem >= mem)
not 
  if (fa_mem <= mem)
.
Only at a higher location can we break the for-loop.

====================================================================== 

---------------------------------------------------------------------- 
 vda - 06-03-08 12:11  
---------------------------------------------------------------------- 
Code is:

size_t
__heap_alloc_at (struct heap *heap, void *mem, size_t size)
{
  struct heap_free_area *fa;
  size_t alloced = 0;
  size = HEAP_ADJUST_SIZE (size);
  /* Look for a free area that can contain SIZE bytes.  */
  for (fa = heap->free_areas; fa; fa = fa->next) {
      void *fa_mem = HEAP_FREE_AREA_START (fa);
      if (fa_mem <= mem) {
          if (fa_mem == mem && fa->size >= size)
            /* FA has the right addr, and is big enough! */
            alloced = __heap_free_area_alloc (heap, fa, size);
          break;
        }
    }
  return alloced;
}

I don't see off-hand why it should be "if (fa_mem >= mem)"... 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
01-19-06 05:31  sluo           New Issue                                    
01-19-06 05:31  sluo           Status                   new => assigned     
01-19-06 05:31  sluo           Assigned To               => uClibc          
06-03-08 12:11  vda            Note Added: 0008104                          
======================================================================




More information about the uClibc-cvs mailing list