diff options
author | Jinjie Ruan <ruanjinjie@huawei.com> | 2023-09-27 17:03:49 +0800 |
---|---|---|
committer | Shuah Khan <skhan@linuxfoundation.org> | 2023-09-28 08:51:02 -0600 |
commit | 24de14c98b37ea40a7e493dfd0d93b400b6efbca (patch) | |
tree | 633f2714f009c9b0482f9acaf75f9e0ae74b713c /lib/find_bit.c | |
parent | e44679515a7b803cf0143dc9de3d2ecbe907f939 (diff) |
kunit: Fix possible memory leak in kunit_filter_suites()
If the outer layer for loop is iterated more than once and it fails not
in the first iteration, the filtered_suite and filtered_suite->test_cases
allocated in the last kunit_filter_attr_tests() in last inner for loop
is leaked.
So add a new free_filtered_suite err label and free the filtered_suite
and filtered_suite->test_cases so far. And change kmalloc_array of copy
to kcalloc to Clear the copy to make the kfree safe.
Fixes: 529534e8cba3 ("kunit: Add ability to filter attributes")
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Reviewed-by: Rae Moar <rmoar@google.com>
Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'lib/find_bit.c')
0 files changed, 0 insertions, 0 deletions