diff --git a/components/dfs/src/dfs_file.c b/components/dfs/src/dfs_file.c index f5619e2354e6154023569b63b79f62ee99f951be..614a34949466f08ebd8789c2c50a6467f8b29423 100644 --- a/components/dfs/src/dfs_file.c +++ b/components/dfs/src/dfs_file.c @@ -335,6 +335,9 @@ int dfs_file_lseek(struct dfs_fd *fd, rt_off_t offset) if (fd == RT_NULL) return -DFS_STATUS_EINVAL; + fs = fd->fs; + if (fs == RT_NULL) + return -DFS_STATUS_EINVAL; if (fs->ops->lseek == RT_NULL) return -DFS_STATUS_ENOSYS; diff --git a/components/finsh/msh.c b/components/finsh/msh.c index a9767058572238ed367e13af469e53b09786d14f..02cbeea196c1fdf4a71599eb6d17d009956eae8b 100644 --- a/components/finsh/msh.c +++ b/components/finsh/msh.c @@ -358,6 +358,9 @@ void msh_auto_complete_path(char *path) struct dirent *dirent = RT_NULL; char *full_path, *ptr, *index; + if (!path) + return; + full_path = (char*)rt_malloc(256); if (full_path == RT_NULL) return; /* out of memory */ diff --git a/components/finsh/msh_cmd.c b/components/finsh/msh_cmd.c index 0ec0b076216040595a5ea6abc5dfcc62804fe403..ca92ef7a6d505bf9ae87f09b3698f8bffde8abf2 100644 --- a/components/finsh/msh_cmd.c +++ b/components/finsh/msh_cmd.c @@ -276,6 +276,7 @@ int cmd_time(int argc, char** argv) } FINSH_FUNCTION_EXPORT_ALIAS(cmd_time, __cmd_time, Execute command with time.); +#ifdef RT_USING_HEAP int cmd_free(int argc, char** argv) { extern void list_mem(void); @@ -284,6 +285,7 @@ int cmd_free(int argc, char** argv) return 0; } FINSH_FUNCTION_EXPORT_ALIAS(cmd_free, __cmd_free, Show the memory usage in the system.); +#endif #endif diff --git a/components/libc/minilibc/stdlib.c b/components/libc/minilibc/stdlib.c index 51cb07fee074cc1b16ccf1419b107c6bfa7c0be3..e29ae9bc2e7ebc94d954b529e18b030bbce356d8 100644 --- a/components/libc/minilibc/stdlib.c +++ b/components/libc/minilibc/stdlib.c @@ -54,6 +54,7 @@ long int atol(const char* s) return sign?-v:v; } +#ifdef RT_USING_HEAP void *malloc(size_t size) { return rt_malloc(size); @@ -73,5 +74,6 @@ void *calloc(size_t nelem, size_t elsize) { return rt_calloc(nelem, elsize); } +#endif #endif diff --git a/src/timer.c b/src/timer.c index f71e40fcd6b2964a6890c70131881193a40771df..ba2801530deb58be257910c23b846fabce5881bf 100644 --- a/src/timer.c +++ b/src/timer.c @@ -293,7 +293,7 @@ RTM_EXPORT(rt_timer_delete); */ rt_err_t rt_timer_start(rt_timer_t timer) { - int row_lvl; + unsigned int row_lvl; rt_list_t *timer_list; register rt_base_t level; rt_list_t *row_head[RT_TIMER_SKIP_LIST_LEVEL];