video/v4l2_cap: fix dereference before null check

Signed-off-by: shizhenghui <shizhenghui@xiaomi.com>
This commit is contained in:
shizhenghui 2024-05-31 10:07:43 +08:00 committed by Alan Carvalho de Assis
parent 33b539a07d
commit 47905c9132

View File

@ -2132,8 +2132,7 @@ static int capture_reqbufs(FAR struct file *filep,
FAR struct inode *inode = filep->f_inode; FAR struct inode *inode = filep->f_inode;
FAR capture_mng_t *cmng = inode->i_private; FAR capture_mng_t *cmng = inode->i_private;
FAR capture_type_inf_t *type_inf; FAR capture_type_inf_t *type_inf;
struct imgdata_s *imgdata = cmng->imgdata; struct imgdata_s *imgdata;
irqstate_t flags; irqstate_t flags;
int ret = OK; int ret = OK;
@ -2142,6 +2141,7 @@ static int capture_reqbufs(FAR struct file *filep,
return -EINVAL; return -EINVAL;
} }
imgdata = cmng->imgdata;
type_inf = get_capture_type_inf(cmng, reqbufs->type); type_inf = get_capture_type_inf(cmng, reqbufs->type);
if (type_inf == NULL) if (type_inf == NULL)
{ {