diff options
author | Ilpo Järvinen <[email protected]> | 2023-07-17 16:14:50 +0300 |
---|---|---|
committer | Shuah Khan <[email protected]> | 2023-07-25 08:52:14 -0600 |
commit | 2d320b1029ee7329ee0638181be967789775b962 (patch) | |
tree | f7951e10fe0de73d00c2a6c258c5286597c9422f /lib/test_fortify/write_overflow-strncpy-src.c | |
parent | 8e289f4542890168705219e54f0231dccfabddbe (diff) |
selftests/resctrl: Don't leak buffer in fill_cache()
The error path in fill_cache() does return before the allocated buffer
is freed leaking the buffer.
The leak was introduced when fill_cache_read() started to return errors
in commit c7b607fa9325 ("selftests/resctrl: Fix null pointer
dereference on open failed"), before that both fill functions always
returned 0.
Move free() earlier to prevent the mem leak.
Fixes: c7b607fa9325 ("selftests/resctrl: Fix null pointer dereference on open failed")
Signed-off-by: Ilpo Järvinen <[email protected]>
Reviewed-by: Reinette Chatre <[email protected]>
Tested-by: Babu Moger <[email protected]>
Tested-by: Shaopeng Tan (Fujitsu) <[email protected]>
Signed-off-by: Shuah Khan <[email protected]>
Diffstat (limited to 'lib/test_fortify/write_overflow-strncpy-src.c')
0 files changed, 0 insertions, 0 deletions