Skip to content

Commit e446795

Browse files
Jinjie Ruanshuahkh
authored andcommitted
kunit: Fix the wrong kfree of copy for kunit_filter_suites()
If the outer layer for loop is iterated more than once and it fails not in the first iteration, the copy pointer has been moved. So it should free the original copy's backup copy_start. Fixes: abbf738 ("kunit: fix possible memory leak in kunit_filter_suites()") 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>
1 parent a6074cf commit e446795

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/kunit/executor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ kunit_filter_suites(const struct kunit_suite_set *suite_set,
243243

244244
free_copy:
245245
if (*err)
246-
kfree(copy);
246+
kfree(copy_start);
247247

248248
return filtered;
249249
}

0 commit comments

Comments
 (0)