Skip to content

Commit

Permalink
class: Free the class private data in class_release
Browse files Browse the repository at this point in the history
Fix a memory leak by freeing the memory allocated in __class_register
for the class private data.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Laurent Pinchart authored and Greg Kroah-Hartman committed Feb 16, 2010
1 parent 7c0ff87 commit 18d19c9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/base/class.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit 18d19c9

Please sign in to comment.