[media] cx88: Fix possible leak in cx8802_probe()

In case allocation vb2_dma_sg_init_ctx() fails during cx8802_probe(), the
already allocated cx8802 device structure memory is not freed in the used
exit path. Thus adapt the cleanup handling accordingly. Detected by Coverity
CID 1260065.

Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This commit is contained in:
Christian Engelmayer 2015-02-14 20:12:56 -03:00 committed by Mauro Carvalho Chehab
parent 2160abb294
commit 96df988bb9

View File

@ -732,7 +732,7 @@ static int cx8802_probe(struct pci_dev *pci_dev,
dev->alloc_ctx = vb2_dma_sg_init_ctx(&pci_dev->dev); dev->alloc_ctx = vb2_dma_sg_init_ctx(&pci_dev->dev);
if (IS_ERR(dev->alloc_ctx)) { if (IS_ERR(dev->alloc_ctx)) {
err = PTR_ERR(dev->alloc_ctx); err = PTR_ERR(dev->alloc_ctx);
goto fail_core; goto fail_dev;
} }
dev->core = core; dev->core = core;
@ -754,6 +754,7 @@ static int cx8802_probe(struct pci_dev *pci_dev,
fail_free: fail_free:
vb2_dma_sg_cleanup_ctx(dev->alloc_ctx); vb2_dma_sg_cleanup_ctx(dev->alloc_ctx);
fail_dev:
kfree(dev); kfree(dev);
fail_core: fail_core:
core->dvbdev = NULL; core->dvbdev = NULL;