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

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

commit ff687c46c8c68e88a9db8d4cd1ee24d540070af9
Author: xuxingliang <[email protected]>
AuthorDate: Sat Sep 6 17:17:33 2025 +0800

    mempool: improve debuggability
    
    Check before modify, so when check fails, we can still get the original 
data.
    
    Signed-off-by: xuxingliang <[email protected]>
---
 mm/mempool/mempool.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/mempool/mempool.c b/mm/mempool/mempool.c
index 3639f993b9b..05ae831e693 100644
--- a/mm/mempool/mempool.c
+++ b/mm/mempool/mempool.c
@@ -83,8 +83,7 @@ mempool_remove_queue(FAR struct mempool_s *pool, FAR 
sq_queue_t *queue)
 
   if (ret)
     {
-      queue->head = ret->flink;
-      if (!queue->head)
+      if (!ret->flink)
         {
           queue->tail = NULL;
         }
@@ -95,6 +94,7 @@ mempool_remove_queue(FAR struct mempool_s *pool, FAR 
sq_queue_t *queue)
           pool->check(pool, addr);
         }
 
+      queue->head = ret->flink;
       ret->flink = NULL;
     }
 

Reply via email to