diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2022-12-29 16:43:25 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2022-12-29 16:43:25 -0800 |
commit | 69fb073b5ba6d7c9358a04115ed61b78c73790ce (patch) | |
tree | fe2f0d925c2d311f3b4dbde4f86cf62cf8e0561e | |
parent | 2258c2dc850b8605cb66b3383e50b9dddd1c6580 (diff) | |
parent | 93ef83050e597634d2c7dc838a28caf5137b9404 (diff) |
Merge tag 'linux-kselftest-kunit-fixes-6.2-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
Pull KUnit fix from Shuah Khan:
- alloc_string_stream_fragment() error path fix to free before
returning a failure.
* tag 'linux-kselftest-kunit-fixes-6.2-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
kunit: alloc_string_stream_fragment error handling bug fix
-rw-r--r-- | lib/kunit/string-stream.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/kunit/string-stream.c b/lib/kunit/string-stream.c index f5f51166d8c2..cc32743c1171 100644 --- a/lib/kunit/string-stream.c +++ b/lib/kunit/string-stream.c @@ -23,8 +23,10 @@ static struct string_stream_fragment *alloc_string_stream_fragment( return ERR_PTR(-ENOMEM); frag->fragment = kunit_kmalloc(test, len, gfp); - if (!frag->fragment) + if (!frag->fragment) { + kunit_kfree(test, frag); return ERR_PTR(-ENOMEM); + } return frag; } |