class: Free the class private data in class_release
authorLaurent Pinchart <[email protected]>
Wed, 10 Feb 2010 12:32:49 +0000 (13:32 +0100)
committerGreg Kroah-Hartman <[email protected]>
Tue, 16 Feb 2010 23:43:00 +0000 (15:43 -0800)
Fix a memory leak by freeing the memory allocated in __class_register
for the class private data.

Signed-off-by: Laurent Pinchart <[email protected]>
Acked-by: Artem Bityutskiy <[email protected]>
Cc: stable <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/base/class.c

index 161746deab4baabb00bebdf4fb0991bbdf693f7f..6e2c3b064f53759d9ea0e56cf43783ff0ecd1a39 100644 (file)
@@ -59,6 +59,8 @@ static void class_release(struct kobject *kobj)
        else
                pr_debug("class '%s' does not have a release() function, "
                         "be careful\n", class->name);
+
+       kfree(cp);
 }
 
 static struct sysfs_ops class_sysfs_ops = {