Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
setSecCtx: free
srcCtx
when getfscreatecon_raw()
fails
``` Error: RESOURCE_LEAK (CWE-772): logrotate-3.18.0/logrotate.c:333: path: Condition "!selinux_enabled", taking false branch. logrotate-3.18.0/logrotate.c:338: alloc_arg: "fgetfilecon_raw" allocates memory that is stored into "srcCtx". logrotate-3.18.0/logrotate.c:338: path: Condition "fgetfilecon_raw(fdSrc, &srcCtx) < 0", taking false branch. logrotate-3.18.0/logrotate.c:349: path: Condition "getfscreatecon_raw(pPrevCtx) < 0", taking true branch. logrotate-3.18.0/logrotate.c:351: leaked_storage: Variable "srcCtx" going out of scope leaks the storage it points to. 349| if (getfscreatecon_raw(pPrevCtx) < 0) { 350| message(MESS_ERROR, "getting default context: %s\n", strerror(errno)); 351|-> return selinux_enforce; 352| } 353| ```
- Loading branch information