USB: Fix a memory leak in em28xx_usb_probe()
[cascardo/linux.git] / drivers / media / video / em28xx / em28xx-video.c
index 36e72c2..40307f3 100644 (file)
@@ -1480,7 +1480,7 @@ static int em28xx_v4l2_ioctl(struct inode *inode, struct file *filp,
        return ret;
 }
 
-static struct file_operations em28xx_v4l_fops = {
+static const struct file_operations em28xx_v4l_fops = {
        .owner = THIS_MODULE,
        .open = em28xx_v4l2_open,
        .release = em28xx_v4l2_close,
@@ -1729,7 +1729,7 @@ static int em28xx_usb_probe(struct usb_interface *interface,
 
        endpoint = &interface->cur_altsetting->endpoint[1].desc;
 
-       /* check if the the device has the iso in endpoint at the correct place */
+       /* check if the device has the iso in endpoint at the correct place */
        if ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) !=
            USB_ENDPOINT_XFER_ISOC) {
                em28xx_err(DRIVER_NAME " probing error: endpoint is non-ISO endpoint!\n");
@@ -1772,6 +1772,7 @@ static int em28xx_usb_probe(struct usb_interface *interface,
        if (dev->alt_max_pkt_size == NULL) {
                em28xx_errdev("out of memory!\n");
                em28xx_devused&=~(1<<nr);
+               kfree(dev);
                return -ENOMEM;
        }