diff --git a/fs/inode/fs_inodesearch.c b/fs/inode/fs_inodesearch.c index fac611a7c8f57..b43eb3c0654d6 100644 --- a/fs/inode/fs_inodesearch.c +++ b/fs/inode/fs_inodesearch.c @@ -429,7 +429,7 @@ static int _inode_search(FAR struct inode_search_s *desc) buflen = PATH_MAX; } - desc->buffer = lib_get_tempbuffer(buflen); + desc->buffer = fs_heap_malloc(buflen); if (desc->buffer == NULL) { return -ENOMEM; @@ -578,7 +578,7 @@ static int _inode_search(FAR struct inode_search_s *desc) { FAR char *buffer = NULL; - buffer = lib_get_tempbuffer(PATH_MAX); + buffer = fs_heap_malloc(PATH_MAX); if (buffer == NULL) { ret = -ENOMEM; @@ -587,7 +587,7 @@ static int _inode_search(FAR struct inode_search_s *desc) { snprintf(buffer, PATH_MAX, "%s/%s", desc->relpath, name); - lib_put_tempbuffer(desc->buffer); + fs_heap_free(desc->buffer); desc->buffer = buffer; relpath = buffer; ret = OK; diff --git a/fs/inode/inode.h b/fs/inode/inode.h index 79a241e6dcce9..08fc76325100e 100644 --- a/fs/inode/inode.h +++ b/fs/inode/inode.h @@ -41,6 +41,8 @@ #include #include +#include "fs_heap.h" + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -63,7 +65,7 @@ { \ if ((d)->buffer != NULL) \ { \ - lib_put_tempbuffer((d)->buffer); \ + fs_heap_free((d)->buffer); \ (d)->buffer = NULL; \ } \ } \ diff --git a/include/nuttx/lib/lib.h b/include/nuttx/lib/lib.h index c6d7e7ada8dc0..8435f183245d1 100644 --- a/include/nuttx/lib/lib.h +++ b/include/nuttx/lib/lib.h @@ -130,8 +130,8 @@ void lib_put_tempbuffer(FAR char *buffer); # define lib_put_tempbuffer(b) #endif -#define lib_get_pathbuffer() lib_get_tempbuffer(PATH_MAX) -#define lib_put_pathbuffer(b) lib_put_tempbuffer(b) +#define lib_get_pathbuffer() lib_malloc(PATH_MAX) +#define lib_put_pathbuffer(b) lib_free(b) /* Functions defined in lib_realpath.c **************************************/