cpufreq: qcom: fix memory leak in error path
authorFabien Parent <fabien.parent@linaro.org>
Sat, 15 Oct 2022 13:04:22 +0000 (15:04 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 30 Oct 2022 08:41:15 +0000 (09:41 +0100)
commite55feb31df3fc78b880d6e9d4b5853f05c974833
tree50047a149903034a8883bc54c7db7cccbdfd0960
parent303d0f761431d848dd8d7ff9fd9b8c101879cabe
cpufreq: qcom: fix memory leak in error path

commit 9f42cf54403a42cb092636804d2628d8ecf71e75 upstream.

If for some reason the speedbin length is incorrect, then there is a
memory leak in the error path because we never free the speedbin buffer.
This commit fixes the error path to always free the speedbin buffer.

Cc: v5.7+ <stable@vger.kernel.org> # v5.7+
Fixes: a8811ec764f9 ("cpufreq: qcom: Add support for krait based socs")
Signed-off-by: Fabien Parent <fabien.parent@linaro.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/cpufreq/qcom-cpufreq-nvmem.c