rtc: class: fix double free in rtc_register_device() error path
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Mon, 20 Jul 2015 23:02:49 +0000 (16:02 -0700)
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>
Sat, 5 Sep 2015 11:19:07 +0000 (13:19 +0200)
commit6706664d92ea841913d5fcfd06c290fbe6d33bd2
tree45a19f8e664116a18607dc69b0c48ba691ba6060
parentdfe6c04aa289de06df95d888719af63d1d4c982d
rtc: class: fix double free in rtc_register_device() error path

Commit 59cca865f21e ("drivers/rtc/class.c: fix device_register() error
handling") correctly noted that naked kfree() should not be used after
failed device_register() call, however, while it added the needed
put_device() it forgot to remove the original kfree() causing double-free.

Cc: Vasiliy Kulikov <segooon@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
drivers/rtc/class.c