Free program last and abort if the exec failed
Fix clang warnings
Check getegid instead of testing getgroups

In reality we only really care about what the effective and real
groups are for the executing process, not all of the groups