media: vidtv: Check for null return of vzalloc
authorJiasheng Jiang <jiasheng@iscas.ac.cn>
Fri, 14 Jan 2022 06:28:40 +0000 (07:28 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Mon, 7 Mar 2022 10:06:19 +0000 (11:06 +0100)
commite6a21a14106d9718aa4f8e115b1e474888eeba44
treec9d9fe68b0886e1a16cc5365e0ce690f458109d0
parent479f4a6e602a46c110affeeb866d2d03422418ee
media: vidtv: Check for null return of vzalloc

As the possible failure of the vzalloc(), e->encoder_buf might be NULL.
Therefore, it should be better to check it in order
to guarantee the success of the initialization.
If fails, we need to free not only 'e' but also 'e->name'.
Also, if the allocation for ctx fails, we need to free 'e->encoder_buf'
else.

Fixes: f90cf6079bf6 ("media: vidtv: add a bridge driver")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/test-drivers/vidtv/vidtv_s302m.c