fs: Avoid accessing filep fields if it is NULL & add DEBUGASSERTs
This commit is contained in:
parent
125d090b9c
commit
c3a34a5956
@ -269,6 +269,9 @@ int files_duplist(FAR struct filelist *plist, FAR struct filelist *clist)
|
||||
int i;
|
||||
int j;
|
||||
|
||||
DEBUGASSERT(clist);
|
||||
DEBUGASSERT(plist);
|
||||
|
||||
ret = nxmutex_lock(&plist->fl_lock);
|
||||
if (ret < 0)
|
||||
{
|
||||
@ -298,7 +301,10 @@ int files_duplist(FAR struct filelist *plist, FAR struct filelist *clist)
|
||||
#endif
|
||||
|
||||
filep = &plist->fl_files[i][j];
|
||||
if (filep->f_inode == NULL || (filep->f_oflags & O_CLOEXEC) != 0)
|
||||
DEBUGASSERT(filep);
|
||||
|
||||
if (filep && (filep->f_inode == NULL ||
|
||||
(filep->f_oflags & O_CLOEXEC) != 0))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user