summaryrefslogtreecommitdiff
path: root/src/basic/selinux-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-09-23 19:55:49 +0200
committerLennart Poettering <lennart@poettering.net>2015-09-29 21:55:51 +0200
commit710a6b5017ba23fde6713f55340db5390ea27cec (patch)
tree34d5c96acc0439f898624a47a9dbfb12d21e957c /src/basic/selinux-util.c
parente8da24a642c78d55f5287011db70d7cd95bf3b2b (diff)
selinux: add _cleanup_ concepts to SELinux label allocation
Diffstat (limited to 'src/basic/selinux-util.c')
-rw-r--r--src/basic/selinux-util.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/basic/selinux-util.c b/src/basic/selinux-util.c
index a39a0f775a..747e6f4dbb 100644
--- a/src/basic/selinux-util.c
+++ b/src/basic/selinux-util.c
@@ -295,14 +295,20 @@ int mac_selinux_get_child_mls_label(int socket_fd, const char *exe, const char *
return r;
}
-void mac_selinux_free(char *label) {
+char* mac_selinux_free(char *label) {
#ifdef HAVE_SELINUX
+ if (!label)
+ return NULL;
+
if (!mac_selinux_use())
- return;
+ return NULL;
+
freecon((security_context_t) label);
#endif
+
+ return NULL;
}
int mac_selinux_create_file_prepare(const char *path, mode_t mode) {