Fix potential resource leak in set_selinux_file_context function

This commit is contained in:
Aleksei Nikiforov 2020-08-04 10:24:46 +03:00
parent 7ea342579e
commit 49930bd3a6

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;
} }
} }