[PATCH 2/2] sestatus: free process and file contexts which are checked

2018-04-22 Thread Nicolas Iooss
clang's static analyzer reports a potential memory leak because the buffers allocated in pc and fc are not freed in main(), in sestatus.c. Free these buffers properly. Signed-off-by: Nicolas Iooss --- policycoreutils/sestatus/sestatus.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/polic

[PATCH 1/2] sestatus: resolve symlinks in path when looking for a process

2018-04-22 Thread Nicolas Iooss
"sestatus -v" uses /proc/$PID/exe symbolic link in order to find the context of processes present in /etc/sestatus.conf. For example, this file includes "/usr/sbin/sshd". On Arch Linux, /bin, /sbin and /usr/sbin are symbolic links to /usr/bin, so sshd process is seen as "/usr/bin/sshd" instead of

[PATCH 1/1] libsemanage: always check append_arg return value

2018-04-22 Thread Nicolas Iooss
When split_args() calls append_arg(), the returned value needs to be checked in order to detect memory allocation failure. Checks were missing in two places, which are spotted by clang's static analyzer: semanage_store.c:1352:7: warning: Value stored to 'rc' is never read rc =