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

acassis 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 7884c18620 Don't call lib_free in the kernel code
7884c18620 is described below

commit 7884c186208346cf989d28241e4c0eb032c98198
Author: Xiang Xiao <[email protected]>
AuthorDate: Thu Aug 3 18:39:11 2023 +0800

    Don't call lib_free in the kernel code
    
    since kernel just allocate memory from kmm_malloc
    
    Signed-off-by: Xiang Xiao <[email protected]>
---
 drivers/crypto/dev_urandom.c | 1 -
 drivers/net/telnet.c         | 2 +-
 drivers/wireless/gs2200m.c   | 2 +-
 fs/inode/fs_inodesearch.c    | 2 +-
 fs/inode/inode.h             | 3 +--
 fs/unionfs/fs_unionfs.c      | 4 ++--
 fs/vfs/fs_dir.c              | 2 +-
 fs/vfs/fs_fdopen.c           | 1 -
 fs/vfs/fs_rename.c           | 4 ++--
 9 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/crypto/dev_urandom.c b/drivers/crypto/dev_urandom.c
index b6c6efda87..47569de06c 100644
--- a/drivers/crypto/dev_urandom.c
+++ b/drivers/crypto/dev_urandom.c
@@ -37,7 +37,6 @@
 #include <errno.h>
 #include <assert.h>
 
-#include <nuttx/lib/lib.h>
 #include <nuttx/lib/xorshift128.h>
 #include <nuttx/semaphore.h>
 #include <nuttx/fs/fs.h>
diff --git a/drivers/net/telnet.c b/drivers/net/telnet.c
index b86f35544a..9b0f0209c0 100644
--- a/drivers/net/telnet.c
+++ b/drivers/net/telnet.c
@@ -720,7 +720,7 @@ static int telnet_close(FAR struct file *filep)
                 }
             }
 
-          lib_free(devpath);
+          kmm_free(devpath);
         }
 
       for (i = 0; i < CONFIG_TELNET_MAXLCLIENTS; i++)
diff --git a/drivers/wireless/gs2200m.c b/drivers/wireless/gs2200m.c
index daec124ef8..adafa80a4f 100644
--- a/drivers/wireless/gs2200m.c
+++ b/drivers/wireless/gs2200m.c
@@ -3542,7 +3542,7 @@ FAR void *gs2200m_register(FAR const char *devpath,
 
 errout:
   nxmutex_destroy(&dev->dev_lock);
-  lib_free(dev->path);
+  kmm_free(dev->path);
   kmm_free(dev);
   return NULL;
 }
diff --git a/fs/inode/fs_inodesearch.c b/fs/inode/fs_inodesearch.c
index 553c143f3b..19905681f1 100644
--- a/fs/inode/fs_inodesearch.c
+++ b/fs/inode/fs_inodesearch.c
@@ -358,7 +358,7 @@ static int _inode_search(FAR struct inode_search_s *desc)
                                                  name);
                                   if (ret > 0)
                                     {
-                                      lib_free(desc->buffer);
+                                      kmm_free(desc->buffer);
                                       desc->buffer = buffer;
                                       relpath = buffer;
                                       ret = OK;
diff --git a/fs/inode/inode.h b/fs/inode/inode.h
index 6ad3e62475..76e0c1e788 100644
--- a/fs/inode/inode.h
+++ b/fs/inode/inode.h
@@ -35,7 +35,6 @@
 
 #include <nuttx/kmalloc.h>
 #include <nuttx/fs/fs.h>
-#include <nuttx/lib/lib.h>
 
 /****************************************************************************
  * Pre-processor Definitions
@@ -59,7 +58,7 @@
     { \
       if ((d)->buffer != NULL) \
         { \
-          lib_free((d)->buffer); \
+          kmm_free((d)->buffer); \
           (d)->buffer  = NULL; \
         } \
     } \
diff --git a/fs/unionfs/fs_unionfs.c b/fs/unionfs/fs_unionfs.c
index 53a726840c..df693a99d7 100644
--- a/fs/unionfs/fs_unionfs.c
+++ b/fs/unionfs/fs_unionfs.c
@@ -1770,7 +1770,7 @@ static int unionfs_readdir(FAR struct inode *mountpt,
 
                       /* Free the allocated relpath */
 
-                      lib_free(relpath);
+                      kmm_free(relpath);
 
                       /* Check for a duplicate */
 
@@ -1857,7 +1857,7 @@ static int unionfs_readdir(FAR struct inode *mountpt,
 
                   /* Free the allocated relpath */
 
-                  lib_free(relpath);
+                  kmm_free(relpath);
                 }
             }
         }
diff --git a/fs/vfs/fs_dir.c b/fs/vfs/fs_dir.c
index fc78f619fe..78f90d1dca 100644
--- a/fs/vfs/fs_dir.c
+++ b/fs/vfs/fs_dir.c
@@ -453,7 +453,7 @@ static int dir_close(FAR struct file *filep)
   /* Release our references on the contained 'root' inode */
 
   inode_release(inode);
-  lib_free(relpath);
+  kmm_free(relpath);
   return ret;
 }
 
diff --git a/fs/vfs/fs_fdopen.c b/fs/vfs/fs_fdopen.c
index 5f7bf7005a..f4f4d4ce6f 100644
--- a/fs/vfs/fs_fdopen.c
+++ b/fs/vfs/fs_fdopen.c
@@ -33,7 +33,6 @@
 #include <nuttx/kmalloc.h>
 #include <nuttx/semaphore.h>
 #include <nuttx/fs/fs.h>
-#include <nuttx/lib/lib.h>
 #include <nuttx/tls.h>
 
 #include "inode/inode.h"
diff --git a/fs/vfs/fs_rename.c b/fs/vfs/fs_rename.c
index d7dfab2b03..745ebd50fe 100644
--- a/fs/vfs/fs_rename.c
+++ b/fs/vfs/fs_rename.c
@@ -245,7 +245,7 @@ errout:
   RELEASE_SEARCH(&newdesc);
   if (subdir != NULL)
     {
-      lib_free(subdir);
+      kmm_free(subdir);
     }
 
   return ret;
@@ -431,7 +431,7 @@ errout_with_newsearch:
   RELEASE_SEARCH(&newdesc);
   if (subdir != NULL)
     {
-      lib_free(subdir);
+      kmm_free(subdir);
     }
 
   return ret;

Reply via email to