From 47905c9132d46a1b71c4f9e6e722291a5e91aa54 Mon Sep 17 00:00:00 2001 From: shizhenghui Date: Fri, 31 May 2024 10:07:43 +0800 Subject: [PATCH] video/v4l2_cap: fix dereference before null check Signed-off-by: shizhenghui --- drivers/video/v4l2_cap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/video/v4l2_cap.c b/drivers/video/v4l2_cap.c index bb6a574c9b..6b36410cf7 100644 --- a/drivers/video/v4l2_cap.c +++ b/drivers/video/v4l2_cap.c @@ -2132,8 +2132,7 @@ static int capture_reqbufs(FAR struct file *filep, FAR struct inode *inode = filep->f_inode; FAR capture_mng_t *cmng = inode->i_private; FAR capture_type_inf_t *type_inf; - struct imgdata_s *imgdata = cmng->imgdata; - + struct imgdata_s *imgdata; irqstate_t flags; int ret = OK; @@ -2142,6 +2141,7 @@ static int capture_reqbufs(FAR struct file *filep, return -EINVAL; } + imgdata = cmng->imgdata; type_inf = get_capture_type_inf(cmng, reqbufs->type); if (type_inf == NULL) {