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 10:03:43 +0000 (11:03 +0100)
commit3a45c47034918d5496e37eb3e2ffae9a1f30b7af
tree7d53ace57774c623d96796115076d53f8037e63e
parent7be5c25e31556f44bf7c4a2079184dcc93768c5d
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