Browse Source

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>
Ming Lei 17 years ago
parent
commit
d4062fcb9e
1 changed files with 3 additions and 0 deletions
  1. 3 0
      drivers/usb/mon/mon_stat.c

+ 3 - 0
drivers/usb/mon/mon_stat.c

@@ -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)
 {
+	struct snap *sp = file->private_data;
+	file->private_data = NULL;
+	kfree(sp);
 	return 0;
 }