USB: Fix memory leak in mon_stat_release

Fix the leak of the snap structure allocated in mon_stat_open().

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Acked-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Ming Lei 2008-04-14 21:27:00 +08:00 committed by Greg Kroah-Hartman
parent 59fba744da
commit d4062fcb9e
1 changed files with 3 additions and 0 deletions

View File

@ -59,6 +59,9 @@ static ssize_t mon_stat_read(struct file *file, char __user *buf,
static int mon_stat_release(struct inode *inode, struct file *file) static int mon_stat_release(struct inode *inode, struct file *file)
{ {
struct snap *sp = file->private_data;
file->private_data = NULL;
kfree(sp);
return 0; return 0;
} }