Fix a bug introduced in the last check-in
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5728 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
2433c1461b
commit
3781d761f3
|
@ -49,6 +49,19 @@
|
|||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
/* If multiple heaps are used, then the heap must be passed as a paramter to
|
||||
* mm_malloc() and mm_free(). If the single heap case, mm_malloc() and
|
||||
* mm_free() are not available and we have to use malloc() and free() (which,
|
||||
* internally will use the same heap).
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_MM_MULTIHEAP
|
||||
# define MM_MALLOC(h,s) mm_malloc(h,s)
|
||||
# define MM_FREE(h,m) mm_free(h,m)
|
||||
#else
|
||||
# define MM_MALLOC(h,s) malloc(s)
|
||||
# define MM_FREE(h,m) free(m)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
|
@ -95,14 +108,14 @@ FAR void *mm_realloc(FAR struct mm_heap_s *heap, FAR void *oldmem,
|
|||
|
||||
if (!oldmem)
|
||||
{
|
||||
return mm_malloc(heap, size);
|
||||
return MM_MALLOC(heap, size);
|
||||
}
|
||||
|
||||
/* If size is zero, then realloc is equivalent to free */
|
||||
|
||||
if (size <= 0)
|
||||
{
|
||||
mm_free(heap, oldmem);
|
||||
MM_FREE(heap, oldmem);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -348,11 +361,11 @@ FAR void *mm_realloc(FAR struct mm_heap_s *heap, FAR void *oldmem,
|
|||
*/
|
||||
|
||||
mm_givesemaphore(heap);
|
||||
newmem = (FAR void*)mm_malloc(heap, size);
|
||||
newmem = (FAR void*)MM_MALLOC(heap, size);
|
||||
if (newmem)
|
||||
{
|
||||
memcpy(newmem, oldmem, oldsize);
|
||||
mm_free(heap, oldmem);
|
||||
MM_FREE(heap, oldmem);
|
||||
}
|
||||
|
||||
return newmem;
|
||||
|
|
Loading…
Reference in New Issue