From: jhbird.choi@samsung.com Date: Mon, 22 Oct 2012 22:54:38 +0000 (+0200) Subject: PM / Domains: Fix memory leak on error path in pm_genpd_attach_cpuidle X-Git-Tag: next-20121024~35^2~10 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=debe081aaa4d247b9957ac2336d84deab32d9909;p=karo-tx-linux.git PM / Domains: Fix memory leak on error path in pm_genpd_attach_cpuidle If pm_genpd_attach_cpudidle failed we leak memory stored in 'cpu_data'. Signed-off-by: Jonghwan Choi Signed-off-by: Rafael J. Wysocki --- diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index c22b869245d9..96b71b6536d6 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -1862,7 +1862,7 @@ int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int state) cpuidle_drv = cpuidle_driver_ref(); if (!cpuidle_drv) { ret = -ENODEV; - goto out; + goto err_drv; } if (cpuidle_drv->state_count <= state) { ret = -EINVAL; @@ -1884,6 +1884,9 @@ int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int state) err: cpuidle_driver_unref(); + + err_drv: + kfree(cpu_data); goto out; }