mirror of
https://github.com/apache/nuttx.git
synced 2026-05-26 10:46:28 +08:00
fs/inode: add sanity check for inode to avoid nullpointer
Change-Id: Ib2c74ba308b8f15756fac4e69632c296243eb4ab Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
+2
-1
@@ -189,7 +189,8 @@ int sockfd_allocate(FAR struct socket *psock, int oflags)
|
||||
|
||||
FAR struct socket *file_socket(FAR struct file *filep)
|
||||
{
|
||||
if (filep != NULL && INODE_IS_SOCKET(filep->f_inode))
|
||||
if (filep != NULL && filep->f_inode != NULL &&
|
||||
INODE_IS_SOCKET(filep->f_inode))
|
||||
{
|
||||
return filep->f_priv;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user