From 1a8962317f494ad858971fc08ba035eff658a5c9 Mon Sep 17 00:00:00 2001 From: Amit Nagal Date: Wed, 7 Sep 2011 13:48:47 +0200 Subject: HID: hidraw: free list for all error in hidraw_open In function hidraw_open struct hidraw_list *list should be freed for all error conditions. Signed-off-by: Amit Nagal Signed-off-by: Jiri Kosina --- drivers/hid/hidraw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/hid/hidraw.c') diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index c79578b5a78..c841a8e7733 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c @@ -259,7 +259,6 @@ static int hidraw_open(struct inode *inode, struct file *file) mutex_lock(&minors_lock); if (!hidraw_table[minor]) { - kfree(list); err = -ENODEV; goto out_unlock; } @@ -285,6 +284,8 @@ static int hidraw_open(struct inode *inode, struct file *file) out_unlock: mutex_unlock(&minors_lock); out: + if (err < 0) + kfree(list); return err; } -- cgit v1.2.3