integrity: Fix memory leakage in keyring allocation error path
authorGUO Zihua <guozihua@huawei.com>
Fri, 11 Nov 2022 10:13:17 +0000 (18:13 +0800)
committerMimi Zohar <zohar@linux.ibm.com>
Wed, 16 Nov 2022 16:47:47 +0000 (11:47 -0500)
commit39419ef7af0916cc3620ecf1ed42d29659109bf3
treea8860ea73819ff37094484b419c843ff0d53f65a
parent8c1d6a050a0f16e0a9d32eaf53b965c77279c6f8
integrity: Fix memory leakage in keyring allocation error path

Key restriction is allocated in integrity_init_keyring(). However, if
keyring allocation failed, it is not freed, causing memory leaks.

Fixes: 2b6aa412ff23 ("KEYS: Use structure to capture key restriction function and data")
Signed-off-by: GUO Zihua <guozihua@huawei.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
security/integrity/digsig.c