libc: Replace all malloc/free to lib_malloc/lib_free

since libc can be built and used in kernel space,
we must call kmm_malloc and kmm_free in this case.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao
2020-07-26 22:43:43 +08:00
committed by Abdelatif Guettouche
parent d2f75467b5
commit 1cb1fb427d
11 changed files with 69 additions and 51 deletions
+4 -2
View File
@@ -30,6 +30,8 @@
#include <string.h>
#include <unistd.h>
#include "libc.h"
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -62,7 +64,7 @@ FAR char *realpath(FAR const char *path, FAR char *resolved)
if (resolved == NULL)
{
fres = resolved = malloc(PATH_MAX);
fres = resolved = lib_malloc(PATH_MAX);
if (resolved == NULL)
{
return NULL;
@@ -230,6 +232,6 @@ loop:
goto loop;
out:
free(fres);
lib_free(fres);
return NULL;
}