Plug a memory leak which can occur when multiple MAC policies are loaded

which label mbufs.  This leak can occur if one policy successfully allocates
label storage and subsequent allocations from other policies fail.

Spotted by:	rwatson
MFC after:	1 week
This commit is contained in:
Christian S.J. Peron 2008-05-27 14:18:02 +00:00
parent 2da0808aec
commit 1f84ab0f2a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=179359

View File

@ -369,6 +369,10 @@ mac_syncache_init(struct label **label)
* allocation failures back to the syncache code.
*/
MAC_CHECK(syncache_init_label, *label, M_NOWAIT);
if (error) {
MAC_PERFORM(syncache_destroy_label, *label);
mac_labelzone_free(*label);
}
return (error);
}