From owner-p4-projects Sat Jul 20 8:17:43 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 694D637B401; Sat, 20 Jul 2002 08:17:38 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0F97037B400 for ; Sat, 20 Jul 2002 08:17:38 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id C06DC43E58 for ; Sat, 20 Jul 2002 08:17:37 -0700 (PDT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from freefall.freebsd.org (perforce@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g6KFHbJU039796 for ; Sat, 20 Jul 2002 08:17:37 -0700 (PDT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g6KFHb84039793 for perforce@freebsd.org; Sat, 20 Jul 2002 08:17:37 -0700 (PDT) Date: Sat, 20 Jul 2002 08:17:37 -0700 (PDT) Message-Id: <200207201517.g6KFHb84039793@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson Subject: PERFORCE change 14524 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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