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:
parent
0554b975da
commit
d63034994e
@ -151,8 +151,11 @@ static int files_extend(FAR struct filelist *list, size_t row)
|
||||
return OK;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
if (tmp != NULL)
|
||||
{
|
||||
kmm_free(tmp);
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user