]> Git Repo - linux.git/commitdiff
kunit: Fix the wrong kfree of copy for kunit_filter_suites()
authorJinjie Ruan <[email protected]>
Wed, 27 Sep 2023 09:03:48 +0000 (17:03 +0800)
committerShuah Khan <[email protected]>
Thu, 28 Sep 2023 14:50:57 +0000 (08:50 -0600)
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: abbf73816b6f ("kunit: fix possible memory leak in kunit_filter_suites()")
Signed-off-by: Jinjie Ruan <[email protected]>
Reviewed-by: Rae Moar <[email protected]>
Reviewed-by: David Gow <[email protected]>
Signed-off-by: Shuah Khan <[email protected]>
lib/kunit/executor.c

index a037a46fae5ea7cc75cfe7d03dc77fce3eb21392..9358ed2df839512b85e252b23ed562d3ad250b75 100644 (file)
@@ -243,7 +243,7 @@ free_parsed_glob:
 
 free_copy:
        if (*err)
-               kfree(copy);
+               kfree(copy_start);
 
        return filtered;
 }
This page took 0.047274 seconds and 4 git commands to generate.