summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--components/finsh/msh_file.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/components/finsh/msh_file.c b/components/finsh/msh_file.c
index 38519ce7a9..10025965f0 100644
--- a/components/finsh/msh_file.c
+++ b/components/finsh/msh_file.c
@@ -101,7 +101,11 @@ int msh_exec_script(const char *cmd_line, int size)
int length;
line_buf = (char *) rt_malloc(RT_CONSOLEBUF_SIZE);
- if (line_buf == RT_NULL) return -RT_ENOMEM;
+ if (line_buf == RT_NULL)
+ {
+ close(fd);
+ return -RT_ENOMEM;
+ }
/* read line by line and then exec it */
do