Date: Sat, 20 Jul 2002 08:17:37 -0700 (PDT) From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 14524 for review Message-ID: <200207201517.g6KFHb84039793@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=14524 Change 14524 by rwatson@rwatson_curry on 2002/07/20 08:16:42 Make sure to release mpc_ops memory in various registration failure modes. Affected files ... .. //depot/projects/trustedbsd/mac/sys/kern/kern_mac.c#176 edit Differences ... ==== //depot/projects/trustedbsd/mac/sys/kern/kern_mac.c#176 (text+ko) ==== @@ -303,10 +303,8 @@ struct mac_policy_op_entry *mpe; int slot; - MALLOC(ops, struct mac_policy_ops *, sizeof(*ops), M_MACOPVEC, + MALLOC(mpc->mpc_ops, struct mac_policy_ops *, sizeof(*ops), M_MACOPVEC, M_WAITOK); - mpc->mpc_ops = ops; - for (mpe = mpc->mpc_entries; mpe->mpe_constant != MAC_OP_LAST; mpe++) { switch (mpe->mpe_constant) { case MAC_OP_LAST: @@ -715,11 +713,15 @@ MAC_POLICY_LIST_LOCK(); if (mac_policy_list_busy > 0) { MAC_POLICY_LIST_UNLOCK(); + FREE(mpc->mpc_ops, M_MACOPVEC); + mpc->mpc_ops = NULL; return (EBUSY); } LIST_FOREACH(tmpc, &mac_policy_list, mpc_list) { if (strcmp(tmpc->mpc_name, mpc->mpc_name) == 0) { MAC_POLICY_LIST_UNLOCK(); + FREE(mpc->mpc_ops, M_MACOPVEC); + mpc->mpc_ops = NULL; return (EEXIST); } } @@ -727,6 +729,8 @@ slot = ffs(mac_policy_offsets_free); if (slot == 0) { MAC_POLICY_LIST_UNLOCK(); + FREE(mpc->mpc_ops, M_MACOPVEC); + mpc->mpc_ops = NULL; return (ENOMEM); } slot--; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200207201517.g6KFHb84039793>