USB: memory leak in iowarrior.c
authorOliver Neukum <oneukum@suse.de>
Tue, 12 Jun 2007 13:36:07 +0000 (15:36 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 26 Jun 2007 06:38:05 +0000 (23:38 -0700)
this is a classical memory leak in the ioctl handler. The buffer is simply
never freed. This fixes it the obvious way.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/misc/iowarrior.c

index fc51207b71b88b83654227151c1aa4c2147ad7b6..3bb33f7bfa3626ee027218832d409e9dbc2cdb2a 100644 (file)
@@ -495,8 +495,8 @@ static int iowarrior_ioctl(struct inode *inode, struct file *file,
 
        /* verify that the device wasn't unplugged */
        if (!dev->present) {
-               mutex_unlock(&dev->mutex);
-               return -ENODEV;
+               retval = -ENODEV;
+               goto error_out;
        }
 
        dbg("%s - minor %d, cmd 0x%.4x, arg %ld", __func__, dev->minor, cmd,
@@ -579,9 +579,10 @@ static int iowarrior_ioctl(struct inode *inode, struct file *file,
                retval = -ENOTTY;
                break;
        }
-
+error_out:
        /* unlock the device */
        mutex_unlock(&dev->mutex);
+       kfree(buffer);
        return retval;
 }