USB: Fix memory leak in mon_stat_release
authorMing Lei <tom.leiming@gmail.com>
Mon, 14 Apr 2008 13:27:00 +0000 (21:27 +0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 25 Apr 2008 04:16:32 +0000 (21:16 -0700)
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>
drivers/usb/mon/mon_stat.c

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