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 c7a78c01c1d82b94109ddadabeeda05fe05185e1
Author: zhaoxingyu1 <[email protected]>
AuthorDate: Mon Nov 3 21:59:27 2025 +0800

    fs/hostfs: change fs_heap to lib_tempbuffer
    
    Migrate hostfs path buffer allocation from fs_heap and stack
    arrays to lib_get_tempbuffer/lib_put_tempbuffer.
    
    Signed-off-by: zhaoxingyu1 <[email protected]>
---
 fs/hostfs/hostfs.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/hostfs/hostfs.c b/fs/hostfs/hostfs.c
index 2503258d41c..c9f24b5fd4a 100644
--- a/fs/hostfs/hostfs.c
+++ b/fs/hostfs/hostfs.c
@@ -1021,6 +1021,7 @@ static int hostfs_rewinddir(FAR struct inode *mountpt,
 static int hostfs_bind(FAR struct inode *blkdriver, FAR const void *data,
                        FAR void **handle)
 {
+  size_t data_size = strlen(data) + 1;
   FAR struct hostfs_mountpt_s *fs;
   FAR char *options;
   FAR char *saveptr;
@@ -1053,13 +1054,14 @@ static int hostfs_bind(FAR struct inode *blkdriver, FAR 
const void *data,
    *  "fs=whatever", remote dir
    */
 
-  options = fs_heap_strdup(data);
+  options = lib_get_tempbuffer(data_size);
   if (!options)
     {
       fs_heap_free(fs);
       return -ENOMEM;
     }
 
+  memcpy(options, data, data_size);
   ptr = strtok_r(options, ",", &saveptr);
   while (ptr != NULL)
     {
@@ -1071,7 +1073,7 @@ static int hostfs_bind(FAR struct inode *blkdriver, FAR 
const void *data,
       ptr = strtok_r(NULL, ",", &saveptr);
     }
 
-  fs_heap_free(options);
+  lib_put_tempbuffer(options);
 
   /* Take the lock for the mount */
 

Reply via email to