From: Oliver Neukum Date: Tue, 12 Jun 2007 13:36:07 +0000 (+0200) Subject: USB: memory leak in iowarrior.c X-Git-Tag: v2.6.22-rc7~49^2~4 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=fc0f8fc9be654bbff08ede04a49bd8f9805b9e13;p=linux-2.6-omap-h63xx.git USB: memory leak in iowarrior.c 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c index fc51207b71b..3bb33f7bfa3 100644 --- a/drivers/usb/misc/iowarrior.c +++ b/drivers/usb/misc/iowarrior.c @@ -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; }