dmi-id: fix a memory leak in dmi_id_init error path
authorAxel Lin <axel.lin@gmail.com>
Thu, 1 Jul 2010 02:35:07 +0000 (10:35 +0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 5 Aug 2010 20:53:34 +0000 (13:53 -0700)
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>
drivers/firmware/dmi-id.c

index a777a35..94a58a0 100644 (file)
@@ -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);