selinux: fix potential memleak in selinux_add_opt()
authorBernard Zhao <bernard@vivo.com>
Fri, 10 Dec 2021 12:03:58 +0000 (04:03 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jan 2022 09:53:58 +0000 (10:53 +0100)
commitb2b1b490bd2983c84566c94b4bf3b0e4279f3ea7
treee094d7bf68a9577e283465ee6c9401f172673446
parent3253cf09146420bda0991eecc6fa9ab2268228e2
selinux: fix potential memleak in selinux_add_opt()

[ Upstream commit 2e08df3c7c4e4e74e3dd5104c100f0bf6288aaa8 ]

This patch try to fix potential memleak in error branch.

Fixes: ba6418623385 ("selinux: new helper - selinux_add_opt()")
Signed-off-by: Bernard Zhao <bernard@vivo.com>
[PM: tweak the subject line, add Fixes tag]
Signed-off-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
security/selinux/hooks.c