[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210128131054.637715-1-colin.king@canonical.com>
Date: Thu, 28 Jan 2021 13:10:54 +0000
From: Colin King <colin.king@...onical.com>
To: Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Ricardo Ribalda <ribalda@...omium.org>,
linux-media@...r.kernel.org
Cc: kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH][next] media: uvcvideo: Fix memory leak when gpiod_to_irq fails
From: Colin Ian King <colin.king@...onical.com>
Currently when the call to gpiod_to_irq fails the error return
path does not kfree the recently allocated object 'unit'. Fix this
by kfree'ing it before returning.
Addresses-Coverity: ("Resource leak")
Fixes: 2886477ff987 ("media: uvcvideo: Implement UVC_EXT_GPIO_UNIT")
Signed-off-by: Colin Ian King <colin.king@...onical.com>
---
drivers/media/usb/uvc/uvc_driver.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index 1abc122a0977..56f867790ef1 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -1543,6 +1543,7 @@ static int uvc_gpio_parse(struct uvc_device *dev)
if (irq != EPROBE_DEFER)
dev_err(&dev->udev->dev,
"No IRQ for privacy GPIO (%d)\n", irq);
+ kfree(unit);
return irq;
}
--
2.29.2
Powered by blists - more mailing lists