aboutsummaryrefslogtreecommitdiff
path: root/sys/security/mac/mac_posix_shm.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/security/mac/mac_posix_shm.c')
-rw-r--r--sys/security/mac/mac_posix_shm.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/security/mac/mac_posix_shm.c b/sys/security/mac/mac_posix_shm.c
index b9da7b3d1ce3..97587ad52133 100644
--- a/sys/security/mac/mac_posix_shm.c
+++ b/sys/security/mac/mac_posix_shm.c
@@ -63,7 +63,10 @@ void
mac_posixshm_init(struct shmfd *shmfd)
{
- shmfd->shm_label = mac_posixshm_label_alloc();
+ if (mac_labeled & MPC_OBJECT_POSIXSHM)
+ shmfd->shm_label = mac_posixshm_label_alloc();
+ else
+ shmfd->shm_label = NULL;
}
static void
@@ -78,8 +81,10 @@ void
mac_posixshm_destroy(struct shmfd *shmfd)
{
- mac_posixshm_label_free(shmfd->shm_label);
- shmfd->shm_label = NULL;
+ if (shmfd->shm_label != NULL) {
+ mac_posixshm_label_free(shmfd->shm_label);
+ shmfd->shm_label = NULL;
+ }
}
void