This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 267976e5a8 mempool:fix bug for realloc when shortage of memory
267976e5a8 is described below

commit 267976e5a8799d67c0224c96f0adefa2d528a1d6
Author: anjiahao <anjia...@xiaomi.com>
AuthorDate: Tue Feb 7 12:40:03 2023 +0800

    mempool:fix bug for realloc when shortage of memory
    
    Signed-off-by: anjiahao <anjia...@xiaomi.com>
---
 mm/mm_heap/mm_realloc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/mm_heap/mm_realloc.c b/mm/mm_heap/mm_realloc.c
index 28fbee2dd7..788fca4f48 100644
--- a/mm/mm_heap/mm_realloc.c
+++ b/mm/mm_heap/mm_realloc.c
@@ -103,8 +103,9 @@ FAR void *mm_realloc(FAR struct mm_heap_s *heap, FAR void 
*oldmem,
         {
           memcpy(newmem, oldmem, size);
           mm_free(heap, oldmem);
-          return newmem;
         }
+
+      return newmem;
     }
 #endif
 

Reply via email to