Merge pull request #270 from darktemplarbasealt/fix_resource_leak

Fix potential resource leak in set_selinux_file_context function
This commit is contained in:
Serge Hallyn 2020-08-10 20:34:50 -05:00 committed by GitHub
commit d041eec354
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,6 +70,7 @@ int set_selinux_file_context (const char *dst_name)
/* Set the security context for the next created file */ /* Set the security context for the next created file */
if (setfscreatecon (scontext) < 0) { if (setfscreatecon (scontext) < 0) {
if (security_getenforce () != 0) { if (security_getenforce () != 0) {
freecon (scontext);
return 1; return 1;
} }
} }