dfs.c: fix null pointer bug.
This commit is contained in:
parent
9a6009e726
commit
ec6f9e3b5a
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue