Skip to content

Commit

Permalink
media: media/pci: Fix memleak in empress_init
Browse files Browse the repository at this point in the history
When vb2_queue_init() fails, dev->empress_dev
should be released just like other error handling
paths.

Fixes: 2ada815 ("[media] saa7134: convert to vb2")
Signed-off-by: Dinghao Liu <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
dinghaoliu authored and mchehab committed Jan 12, 2021
1 parent cf73a66 commit 15d0c52
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/media/pci/saa7134/saa7134-empress.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,11 @@ static int empress_init(struct saa7134_dev *dev)
q->lock = &dev->lock;
q->dev = &dev->pci->dev;
err = vb2_queue_init(q);
if (err)
if (err) {
video_device_release(dev->empress_dev);
dev->empress_dev = NULL;
return err;
}
dev->empress_dev->queue = q;
dev->empress_dev->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING |
V4L2_CAP_VIDEO_CAPTURE;
Expand Down

0 comments on commit 15d0c52

Please sign in to comment.