summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/uvc/uvc_status.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@skynet.be>2009-01-22 16:45:10 +0100
committerLaurent Pinchart <laurent.pinchart@skynet.be>2009-01-22 16:45:10 +0100
commit8031abacbe51fa4062ff4bf1a34751b6a39460eb (patch)
tree38601fef7d5f51f79ee99b7f7e2317cc1b1688cb /linux/drivers/media/video/uvc/uvc_status.c
parentbe9951c102c6290821cff8866c06615a4cea2a89 (diff)
downloadmediapointer-dvb-s2-8031abacbe51fa4062ff4bf1a34751b6a39460eb.tar.gz
mediapointer-dvb-s2-8031abacbe51fa4062ff4bf1a34751b6a39460eb.tar.bz2
uvcvideo: Fix memory leak in input device handling
From: Laurent Pinchart <laurent.pinchart@skynet.be> The dynamically allocated input_dev->phys buffer isn't freed when unregistering the device. As the input layer doesn't provide any release callback, use a fixed-size buffer inside the uvc_device structure. Priority: normal Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Diffstat (limited to 'linux/drivers/media/video/uvc/uvc_status.c')
-rw-r--r--linux/drivers/media/video/uvc/uvc_status.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/linux/drivers/media/video/uvc/uvc_status.c b/linux/drivers/media/video/uvc/uvc_status.c
index 77a263463..4f4171fa8 100644
--- a/linux/drivers/media/video/uvc/uvc_status.c
+++ b/linux/drivers/media/video/uvc/uvc_status.c
@@ -28,26 +28,19 @@
#ifdef CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV
static int uvc_input_init(struct uvc_device *dev)
{
- struct usb_device *udev = dev->udev;
struct input_dev *input;
- char *phys = NULL;
int ret;
input = input_allocate_device();
if (input == NULL)
return -ENOMEM;
- phys = kmalloc(6 + strlen(udev->bus->bus_name) + strlen(udev->devpath),
- GFP_KERNEL);
- if (phys == NULL) {
- ret = -ENOMEM;
- goto error;
- }
- sprintf(phys, "usb-%s-%s", udev->bus->bus_name, udev->devpath);
+ usb_make_path(dev->udev, dev->input_phys, sizeof(dev->input_phys));
+ strlcat(dev->input_phys, "/button", sizeof(dev->input_phys));
input->name = dev->name;
- input->phys = phys;
- usb_to_input_id(udev, &input->id);
+ input->phys = dev->input_phys;
+ usb_to_input_id(dev->udev, &input->id);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22)
input->dev.parent = &dev->intf->dev;
#else
@@ -65,7 +58,6 @@ static int uvc_input_init(struct uvc_device *dev)
error:
input_free_device(input);
- kfree(phys);
return ret;
}