diff options
author | Miaoqian Lin | 2022-06-21 06:30:30 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab | 2022-06-27 09:24:45 +0100 |
commit | e0b212ec9d8177d6f7c404315293f6a085d6ee42 (patch) | |
tree | fe9b343c78b66a3616e0486a450c43fb2435b90d /drivers/media/pci | |
parent | 5b304046a81eda221b5d06a9c62f7b5e45530fa5 (diff) |
media: tw686x: Fix memory leak in tw686x_video_init
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: 704a84ccdbf1 ("[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>
Diffstat (limited to 'drivers/media/pci')
-rw-r--r-- | drivers/media/pci/tw686x/tw686x-video.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/media/pci/tw686x/tw686x-video.c b/drivers/media/pci/tw686x/tw686x-video.c index 6344a479119f..3ebf7a2c95f0 100644 --- a/drivers/media/pci/tw686x/tw686x-video.c +++ b/drivers/media/pci/tw686x/tw686x-video.c @@ -1280,8 +1280,10 @@ int tw686x_video_init(struct tw686x_dev *dev) video_set_drvdata(vdev, vc); err = video_register_device(vdev, VFL_TYPE_VIDEO, -1); - if (err < 0) + if (err < 0) { + video_device_release(vdev); goto error; + } vc->num = vdev->num; } |