Skip to content

Commit

Permalink
HID: hidraw: free list for all error in hidraw_open
Browse files Browse the repository at this point in the history
In function hidraw_open struct hidraw_list *list should be freed for
all error conditions.

Signed-off-by: Amit Nagal <helloin.amit@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Amit Nagal authored and Jiri Kosina committed Sep 7, 2011
1 parent ba623a7 commit 1a89623
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/hid/hidraw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;

}
Expand Down

0 comments on commit 1a89623

Please sign in to comment.