diff options
author | Laurent Pinchart <laurent.pinchart@skynet.be> | 2009-01-22 18:45:10 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 19:42:26 +0400 |
commit | f180152376c984a6faa9decb8f2811c373da9141 (patch) | |
tree | 61efd7457f949e1bfa78f931e748659ec2d315ac /drivers/media/video/uvc/uvc_status.c | |
parent | efdc8a9585ce02e70e538e46f235aefd63a3f8da (diff) | |
download | linux-f180152376c984a6faa9decb8f2811c373da9141.tar.xz |
V4L/DVB (10296): uvcvideo: Fix memory leak in input device handling
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.
Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/uvc/uvc_status.c')
-rw-r--r-- | drivers/media/video/uvc/uvc_status.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/drivers/media/video/uvc/uvc_status.c b/drivers/media/video/uvc/uvc_status.c index c705f248da88..21d87124986b 100644 --- a/drivers/media/video/uvc/uvc_status.c +++ b/drivers/media/video/uvc/uvc_status.c @@ -24,26 +24,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); input->dev.parent = &dev->intf->dev; __set_bit(EV_KEY, input->evbit); @@ -57,7 +50,6 @@ static int uvc_input_init(struct uvc_device *dev) error: input_free_device(input); - kfree(phys); return ret; } |