提交 96c9aea1 编写于 作者: P prife

Merge pull request #69 from geniusgogo/dfs-fixbug

dfs.c: fix null pointer bug.
......@@ -304,6 +304,9 @@ char *dfs_normalize_path(const char *directory, const char *filename)
{
fullpath = rt_malloc(strlen(directory) + strlen(filename) + 2);
if (fullpath == RT_NULL)
return RT_NULL;
/* join path and file name */
rt_snprintf(fullpath, strlen(directory) + strlen(filename) + 2,
"%s/%s", directory, filename);
......@@ -311,6 +314,9 @@ char *dfs_normalize_path(const char *directory, const char *filename)
else
{
fullpath = rt_strdup(filename); /* copy string */
if (fullpath == RT_NULL)
return RT_NULL;
}
src = fullpath;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册