mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 05:55:44 +02:00
media: tw686x: Fix memory leak in tw686x_video_init
[ Upstream commite0b212ec9d] video_device_alloc() allocates memory for vdev, when video_register_device() fails, it doesn't release the memory and leads to memory leak, call video_device_release() to fix this. Fixes:704a84ccdb("[media] media: Support Intersil/Techwell TW686x-based video capture cards") Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
7f7336ce35
commit
611f86965d
|
|
@ -1283,8 +1283,10 @@ int tw686x_video_init(struct tw686x_dev *dev)
|
||||||
video_set_drvdata(vdev, vc);
|
video_set_drvdata(vdev, vc);
|
||||||
|
|
||||||
err = video_register_device(vdev, VFL_TYPE_VIDEO, -1);
|
err = video_register_device(vdev, VFL_TYPE_VIDEO, -1);
|
||||||
if (err < 0)
|
if (err < 0) {
|
||||||
|
video_device_release(vdev);
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
vc->num = vdev->num;
|
vc->num = vdev->num;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user