Don't call lib_free in the kernel code

since kernel just allocate memory from kmm_malloc

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2023-08-03 18:39:11 +08:00 committed by Alan Carvalho de Assis
parent 6289205104
commit 7884c18620
9 changed files with 9 additions and 12 deletions

View File

@ -37,7 +37,6 @@
#include <errno.h> #include <errno.h>
#include <assert.h> #include <assert.h>
#include <nuttx/lib/lib.h>
#include <nuttx/lib/xorshift128.h> #include <nuttx/lib/xorshift128.h>
#include <nuttx/semaphore.h> #include <nuttx/semaphore.h>
#include <nuttx/fs/fs.h> #include <nuttx/fs/fs.h>

View File

@ -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++) for (i = 0; i < CONFIG_TELNET_MAXLCLIENTS; i++)

View File

@ -3542,7 +3542,7 @@ FAR void *gs2200m_register(FAR const char *devpath,
errout: errout:
nxmutex_destroy(&dev->dev_lock); nxmutex_destroy(&dev->dev_lock);
lib_free(dev->path); kmm_free(dev->path);
kmm_free(dev); kmm_free(dev);
return NULL; return NULL;
} }

View File

@ -358,7 +358,7 @@ static int _inode_search(FAR struct inode_search_s *desc)
name); name);
if (ret > 0) if (ret > 0)
{ {
lib_free(desc->buffer); kmm_free(desc->buffer);
desc->buffer = buffer; desc->buffer = buffer;
relpath = buffer; relpath = buffer;
ret = OK; ret = OK;

View File

@ -35,7 +35,6 @@
#include <nuttx/kmalloc.h> #include <nuttx/kmalloc.h>
#include <nuttx/fs/fs.h> #include <nuttx/fs/fs.h>
#include <nuttx/lib/lib.h>
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
@ -59,7 +58,7 @@
{ \ { \
if ((d)->buffer != NULL) \ if ((d)->buffer != NULL) \
{ \ { \
lib_free((d)->buffer); \ kmm_free((d)->buffer); \
(d)->buffer = NULL; \ (d)->buffer = NULL; \
} \ } \
} \ } \

View File

@ -1770,7 +1770,7 @@ static int unionfs_readdir(FAR struct inode *mountpt,
/* Free the allocated relpath */ /* Free the allocated relpath */
lib_free(relpath); kmm_free(relpath);
/* Check for a duplicate */ /* Check for a duplicate */
@ -1857,7 +1857,7 @@ static int unionfs_readdir(FAR struct inode *mountpt,
/* Free the allocated relpath */ /* Free the allocated relpath */
lib_free(relpath); kmm_free(relpath);
} }
} }
} }

View File

@ -453,7 +453,7 @@ static int dir_close(FAR struct file *filep)
/* Release our references on the contained 'root' inode */ /* Release our references on the contained 'root' inode */
inode_release(inode); inode_release(inode);
lib_free(relpath); kmm_free(relpath);
return ret; return ret;
} }

View File

@ -33,7 +33,6 @@
#include <nuttx/kmalloc.h> #include <nuttx/kmalloc.h>
#include <nuttx/semaphore.h> #include <nuttx/semaphore.h>
#include <nuttx/fs/fs.h> #include <nuttx/fs/fs.h>
#include <nuttx/lib/lib.h>
#include <nuttx/tls.h> #include <nuttx/tls.h>
#include "inode/inode.h" #include "inode/inode.h"

View File

@ -245,7 +245,7 @@ errout:
RELEASE_SEARCH(&newdesc); RELEASE_SEARCH(&newdesc);
if (subdir != NULL) if (subdir != NULL)
{ {
lib_free(subdir); kmm_free(subdir);
} }
return ret; return ret;
@ -431,7 +431,7 @@ errout_with_newsearch:
RELEASE_SEARCH(&newdesc); RELEASE_SEARCH(&newdesc);
if (subdir != NULL) if (subdir != NULL)
{ {
lib_free(subdir); kmm_free(subdir);
} }
return ret; return ret;