Skip to content

Commit

Permalink
PM / Domains: Fix memory leak on error path in pm_genpd_attach_cpuidle
Browse files Browse the repository at this point in the history
If pm_genpd_attach_cpudidle failed we leak memory stored in 'cpu_data'.

Signed-off-by: Jonghwan Choi <jhbird.choi@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
jhbird.choi@samsung.com authored and rafaeljw committed Oct 22, 2012
1 parent 2978af5 commit debe081
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/base/power/domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down

0 comments on commit debe081

Please sign in to comment.