Skip to content

Commit

Permalink
Merge tag 'linux-kselftest-kunit-fixes-6.2-rc2' of git://git.kernel.o…
Browse files Browse the repository at this point in the history
…rg/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
  • Loading branch information
torvalds committed Dec 30, 2022
2 parents 2258c2d + 93ef830 commit 69fb073
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/kunit/string-stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 69fb073

Please sign in to comment.