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

commit 62850f31635c96c7de85ef3601d586441ed29ffd
Author: anjiahao <[email protected]>
AuthorDate: Thu Jun 6 14:58:45 2024 +0800

    mempool:when deinit mempool,need mark dict NULL before free
    
    Signed-off-by: anjiahao <[email protected]>
---
 mm/mempool/mempool_multiple.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/mempool/mempool_multiple.c b/mm/mempool/mempool_multiple.c
index d165c665aa..30b2928740 100644
--- a/mm/mempool/mempool_multiple.c
+++ b/mm/mempool/mempool_multiple.c
@@ -303,7 +303,7 @@ mempool_multiple_get_dict(FAR struct mempool_multiple_s 
*mpool,
   size_t row;
   size_t col;
 
-  if (mpool == NULL || blk == NULL)
+  if (mpool == NULL || blk == NULL || mpool->dict == NULL)
     {
       return NULL;
     }
@@ -888,6 +888,7 @@ void mempool_multiple_deinit(FAR struct mempool_multiple_s 
*mpool)
     }
 
   mempool_multiple_free_chunk(mpool, mpool->dict);
+  mpool->dict = NULL;
   nxrmutex_destroy(&mpool->lock);
   mpool->free(mpool->arg, mpool);
 }

Reply via email to