driver core: fix memory leak on one error path in bus_register()
authorJike Song <albcamus@gmail.com>
Thu, 15 Jul 2010 09:43:54 +0000 (17:43 +0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 5 Aug 2010 20:53:35 +0000 (13:53 -0700)
Reported-by: huangweibing@gmail.com
Signed-off-by: Jike Song <albcamus@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/base/bus.c

index 12eec3f..eb1b7fa 100644 (file)
@@ -945,8 +945,8 @@ bus_devices_fail:
        bus_remove_file(bus, &bus_attr_uevent);
 bus_uevent_fail:
        kset_unregister(&bus->p->subsys);
-       kfree(bus->p);
 out:
+       kfree(bus->p);
        bus->p = NULL;
        return retval;
 }