summaryrefslogtreecommitdiff
path: root/drivers/amba/bus.c
diff options
context:
space:
mode:
authorJinjie Ruan <ruanjinjie@huawei.com>2024-10-16 09:24:53 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-11-08 16:28:23 +0100
commit62c11896683129790b8f5ab6eb7e695818b0b723 (patch)
tree1233b2ef47ef0dfd41e1c0dd97d143129dfcb4d1 /drivers/amba/bus.c
parent3dc0eda2cd5c653b162852ae5f0631bfe4ca5e95 (diff)
downloadlinux-rpi-62c11896683129790b8f5ab6eb7e695818b0b723.tar.gz
linux-rpi-62c11896683129790b8f5ab6eb7e695818b0b723.tar.bz2
linux-rpi-62c11896683129790b8f5ab6eb7e695818b0b723.zip
iio: gts-helper: Fix memory leaks for the error path of iio_gts_build_avail_scale_table()
commit 369f05688911b05216cfcd6ca74473bec87948d7 upstream. If per_time_scales[i] or per_time_gains[i] kcalloc fails in the for loop of iio_gts_build_avail_scale_table(), the err_free_out will fail to call kfree() each time when i is reduced to 0, so all the per_time_scales[0] and per_time_gains[0] will not be freed, which will cause memory leaks. Fix it by checking if i >= 0. Cc: stable@vger.kernel.org Fixes: 38416c28e168 ("iio: light: Add gain-time-scale helpers") Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> Link: https://patch.msgid.link/20241016012453.2013302-1-ruanjinjie@huawei.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/amba/bus.c')
0 files changed, 0 insertions, 0 deletions