Skip to content

Commit

Permalink
dmi-id: fix a memory leak in dmi_id_init error path
Browse files Browse the repository at this point in the history
This patch adds a missing kfree(dmi_dev) in dmi_id_init error path.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Axel Lin authored and Greg Kroah-Hartman committed Aug 5, 2010
1 parent 49c1940 commit 5b232f7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/firmware/dmi-id.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,12 @@ static int __init dmi_id_init(void)

ret = device_register(dmi_dev);
if (ret)
goto fail_class_unregister;
goto fail_free_dmi_dev;

return 0;

fail_free_dmi_dev:
kfree(dmi_dev);
fail_class_unregister:

class_unregister(&dmi_class);
Expand Down

0 comments on commit 5b232f7

Please sign in to comment.