瀏覽代碼

Update msh_file.c

David Lin 5 年之前
父節點
當前提交
5bb38bb4e8
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      components/finsh/msh_file.c

+ 5 - 1
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