Skip to content

Commit 69fb073

Browse files
committed
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
2 parents 2258c2d + 93ef830 commit 69fb073

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/kunit/string-stream.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ static struct string_stream_fragment *alloc_string_stream_fragment(
2323
return ERR_PTR(-ENOMEM);
2424

2525
frag->fragment = kunit_kmalloc(test, len, gfp);
26-
if (!frag->fragment)
26+
if (!frag->fragment) {
27+
kunit_kfree(test, frag);
2728
return ERR_PTR(-ENOMEM);
29+
}
2830

2931
return frag;
3032
}

0 commit comments

Comments
 (0)