]> www.infradead.org Git - users/dwmw2/linux.git/commit
media: cpia2_usb: fix memory leaks
authorWenwen Wang <wenwen@cs.uga.edu>
Sat, 17 Aug 2019 05:27:46 +0000 (02:27 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 5 Oct 2019 11:13:48 +0000 (13:13 +0200)
commit1c6a694568dbbe9c6e6294c1b65ed88caf8df5bd
treea0820de8b9ecc69e397613f0c65da969c7962a90
parentecc5486763604658933b7679db2e1c5432b28d3c
media: cpia2_usb: fix memory leaks

[ Upstream commit 1c770f0f52dca1a2323c594f01f5ec6f1dddc97f ]

In submit_urbs(), 'cam->sbuf[i].data' is allocated through kmalloc_array().
However, it is not deallocated if the following allocation for urbs fails.
To fix this issue, free 'cam->sbuf[i].data' if usb_alloc_urb() fails.

Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/usb/cpia2/cpia2_usb.c