diff options
| author | Jinjie Ruan <[email protected]> | 2024-10-16 01:24:53 +0000 |
|---|---|---|
| committer | Jonathan Cameron <[email protected]> | 2024-10-19 14:10:33 +0000 |
| commit | 369f05688911b05216cfcd6ca74473bec87948d7 (patch) | |
| tree | a961683a7d0f969525f582f6d2c0c7b3665f6bab /tools/perf/util/trace-event-scripting.c | |
| parent | iio: gts-helper: Fix memory leaks in iio_gts_build_avail_scale_table() (diff) | |
| download | kernel-369f05688911b05216cfcd6ca74473bec87948d7.tar.gz kernel-369f05688911b05216cfcd6ca74473bec87948d7.zip | |
iio: gts-helper: Fix memory leaks for the error path of iio_gts_build_avail_scale_table()
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: [email protected]
Fixes: 38416c28e168 ("iio: light: Add gain-time-scale helpers")
Reviewed-by: Matti Vaittinen <[email protected]>
Signed-off-by: Jinjie Ruan <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jonathan Cameron <[email protected]>
Diffstat (limited to 'tools/perf/util/trace-event-scripting.c')
0 files changed, 0 insertions, 0 deletions
