upstream: [media] usbvision-video: fix memory leak of alt_max_pkt_size
authorAlexey Khoroshilov <khoroshilov@ispras.ru>
Mon, 10 Jun 2013 20:32:29 +0000 (17:32 -0300)
committerChanho Park <chanho61.park@samsung.com>
Tue, 18 Nov 2014 02:48:37 +0000 (11:48 +0900)
commit8c51552cd2f69544dfe97c19d89ef67e0940ad80
tree6deedefc28f10e2df28d709fd33756aaeabafcb1
parentfcedb143a4873bfa0a42aeaa1441d3aa47344a39
upstream: [media] usbvision-video: fix memory leak of alt_max_pkt_size

1. usbvision->alt_max_pkt_size is not deallocated anywhere.
2. if allocation of usbvision->alt_max_pkt_size fails,
there is no proper deallocation of already acquired resources.
The patch adds kfree(usbvision->alt_max_pkt_size) to
usbvision_release() as soon as other deallocations happen there.
It calls usbvision_release() if allocation of
usbvision->alt_max_pkt_size fails as soon as usbvision_release()
is safe to work with incompletely initialized usbvision structure.
Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/usb/usbvision/usbvision-video.c