net/devif: fix null pointer reference found out by coverity

Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
chao an 2023-02-20 14:44:27 +08:00 committed by Xiang Xiao
parent b8ef55d201
commit fcefd16586

View file

@ -150,7 +150,11 @@ int devif_file_send(FAR struct net_driver_s *dev, FAR struct file *file,
errout:
if (ret < 0)
{
netdev_iob_release(dev);
if (dev != NULL)
{
netdev_iob_release(dev);
}
nerr("ERROR: devif_iob_send error: %d\n", ret);
}