summaryrefslogtreecommitdiff
path: root/sys/security/mac/mac_posix_sem.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/security/mac/mac_posix_sem.c')
-rw-r--r--sys/security/mac/mac_posix_sem.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/security/mac/mac_posix_sem.c b/sys/security/mac/mac_posix_sem.c
index 2296afeeb7acd..1cda22cd4fb10 100644
--- a/sys/security/mac/mac_posix_sem.c
+++ b/sys/security/mac/mac_posix_sem.c
@@ -64,7 +64,10 @@ void
mac_posixsem_init(struct ksem *ks)
{
- ks->ks_label = mac_posixsem_label_alloc();
+ if (mac_labeled & MPC_OBJECT_POSIXSEM)
+ ks->ks_label = mac_posixsem_label_alloc();
+ else
+ ks->ks_label = NULL;
}
static void
@@ -79,8 +82,10 @@ void
mac_posixsem_destroy(struct ksem *ks)
{
- mac_posixsem_label_free(ks->ks_label);
- ks->ks_label = NULL;
+ if (ks->ks_label != NULL) {
+ mac_posixsem_label_free(ks->ks_label);
+ ks->ks_label = NULL;
+ }
}
void