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

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


The following commit(s) were added to refs/heads/releases/12.12 by this push:
     new b2c1a4e1624 mqueue:fix msgq memleak
b2c1a4e1624 is described below

commit b2c1a4e16247295374f673133c6dd0aa96ce9a08
Author: anjiahao <[email protected]>
AuthorDate: Wed Mar 19 16:37:39 2025 +0800

    mqueue:fix msgq memleak
    
    if first call unlink after call nxmq_file_close
    cause i_crefs not 0 will leak msqg, inode will
    free in unlink, but forget free msgq
    
    Signed-off-by: anjiahao <[email protected]>
---
 fs/mqueue/mq_open.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/mqueue/mq_open.c b/fs/mqueue/mq_open.c
index 9cf984a9a1c..f51d1eeb3c8 100644
--- a/fs/mqueue/mq_open.c
+++ b/fs/mqueue/mq_open.c
@@ -76,7 +76,7 @@ static int nxmq_file_close(FAR struct file *filep)
 {
   FAR struct inode *inode = filep->f_inode;
 
-  if (atomic_read(&inode->i_crefs) <= 0)
+  if (atomic_read(&inode->i_crefs) <= 1)
     {
       FAR struct mqueue_inode_s *msgq = inode->i_private;
 

Reply via email to