media: uvcvideo: Fix memory leak of object map on error exit path
authorColin Ian King <colin.king@canonical.com>
Fri, 17 Sep 2021 11:49:30 +0000 (13:49 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 7 Dec 2021 10:29:53 +0000 (11:29 +0100)
commit4b065060555b14c7a9b86c013a1c9bee8e8b6fbd
tree67ac7fc53564a6b684d8fab6c6a0dca909325440
parent4383cfa18c5bbc5b9b6a9e77adc12aec1c20b72d
media: uvcvideo: Fix memory leak of object map on error exit path

Currently when the allocation of map->name fails the error exit path
does not kfree the previously allocated object map. Fix this by
setting ret to -ENOMEM and taking the free_map exit error path to
ensure map is kfree'd.

Addresses-Coverity: ("Resource leak")

Fixes: 70fa906d6fce ("media: uvcvideo: Use control names from framework")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/usb/uvc/uvc_v4l2.c