mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-21 22:47:51 -04:00
OPP: of: Fix potential memory leak in opp_parse_supplies()
The memory allocated for microvolt, microamp and microwatt is not freed
in one of the paths in opp_parse_supplies() which returns directly.
Fix that by adding a goto to the error unwind ladder.
Fixes: 2eedf62e66 ("OPP: decouple dt properties in opp_parse_supplies()")
Cc: stable@vger.kernel.org
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
This commit is contained in:
committed by
Viresh Kumar
parent
f5e1cc9a28
commit
69f888381d
@@ -673,7 +673,7 @@ static int opp_parse_supplies(struct dev_pm_opp *opp, struct device *dev,
|
||||
*/
|
||||
if (unlikely(opp_table->regulator_count == -1)) {
|
||||
opp_table->regulator_count = 0;
|
||||
return 0;
|
||||
goto free_microwatt;
|
||||
}
|
||||
|
||||
for (i = 0, j = 0; i < opp_table->regulator_count; i++) {
|
||||
@@ -696,6 +696,7 @@ static int opp_parse_supplies(struct dev_pm_opp *opp, struct device *dev,
|
||||
opp->supplies[i].u_watt = microwatt[i];
|
||||
}
|
||||
|
||||
free_microwatt:
|
||||
kfree(microwatt);
|
||||
free_microamp:
|
||||
kfree(microamp);
|
||||
|
||||
Reference in New Issue
Block a user