mirror of
https://github.com/apache/nuttx.git
synced 2026-05-20 20:44:39 +08:00
fs/inode: check file list before memcpy
The file list is NULL if task group initialized, check the validity of the file list before memcpy. Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
committed by
Alan Carvalho de Assis
parent
0554b975da
commit
d63034994e
+9
-3
@@ -151,8 +151,11 @@ static int files_extend(FAR struct filelist *list, size_t row)
|
||||
return OK;
|
||||
}
|
||||
|
||||
memcpy(files, list->fl_files,
|
||||
list->fl_rows * sizeof(FAR struct file *));
|
||||
if (list->fl_files != NULL)
|
||||
{
|
||||
memcpy(files, list->fl_files,
|
||||
list->fl_rows * sizeof(FAR struct file *));
|
||||
}
|
||||
|
||||
tmp = list->fl_files;
|
||||
list->fl_files = files;
|
||||
@@ -160,7 +163,10 @@ static int files_extend(FAR struct filelist *list, size_t row)
|
||||
|
||||
spin_unlock_irqrestore(&list->fl_lock, flags);
|
||||
|
||||
kmm_free(tmp);
|
||||
if (tmp != NULL)
|
||||
{
|
||||
kmm_free(tmp);
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user